0 Replies Latest reply on May 12, 2008 5:55 PM by Vikram Chhetry

    Select only required data ejb ql

    Vikram Chhetry Newbie

      Hi All,


      Let me explain the problem:


      I have a user who is associated to a Company, Department, Type etc.


      My User Table is like this:


      user_id


      user_name


      company_id


      department_id


      type_id


      When I search all the users I write:


      List<User> userList = entityManager.createQuery("select u from User u").getResultList();
      



      I can see in the logs hibernate executing the query and selecting all the companies, departments and types.


      This is a very small scenario. In my usecase User is associated to many tables and my query goes and selects all the information.



      I want to know how to  select only required column value from my query.


      Hope I made myself clear.


      Any help would be appreciated.


      Thanks


      Vikram