1 Reply Latest reply on Jun 15, 2011 4:19 PM by Roger Mori

    Hibernate table join issue

    Piotr Salski Newbie

      Hi all


      I have problem with writing the query. My working method looks like this

      public void profesionChanged(ValueChangeEvent event){
      
      
                profesion.clear();
                doctor.clear();
                
                
               String query ="select distinct p from ProfessionEntity p, DoctorEntity d where p.id=d.profesion and location_id = " + (String)event.getNewValue();
               professionList=  entityManager.createQuery(query).getResultList();
                    
                 for (ProfessionEntity typ: professionList) {
                      item = new SelectItem(typ.getId() , typ.getProfession());
                      profesion.add(item);
                  }
                 
        
           }



      but I don't know how to write query with left join


      Query from MSSQL

      select p.*, d.* from ProfessionEntity p left join DoctorEntity d on p.id=d.profesion 
      



      Please HELP