Re: [perfectjpattern-users] Queries in Jpa dao
Brought to you by:
bravegag
From: Giovanni A. <bra...@gm...> - 2010-12-17 12:24:33
|
Hello again, Oh I see now what you mean. I am sorry in 1.0.2 there is no way to do that, IQuery is quite limited. If you could fetch and build the snapshot 1.0.3 (trunk) then you can do this is the way you want. In 1.0.3 all improvements related to the Generic DAO implementation (including adding the necessary IQuery features) are stable and fully covered with unit tests. Best regards, Giovanni On Dec 17, 2010, at 3:22 AM, Mansour Al Akeel wrote: > Hello all: > How do I use queires in a DAO that extends AbstractJpaManagedBaseDao ? > > For example, AbstractJpaManagedBaseDao prevents accessing entityManager. > So I can not use queries to select of filter some objects. Here's a > code: > > @Stateless(name = "GeoDao") > public class GeoDaoImpl extends AbstractJpaManagedBaseDao<String, Geo> implements GeoDao { > > public GeoDaoImpl() { > super(Geo.class); > } > > @PersistenceContext(unitName = "myPU") > public void setEntityManager(EntityManager em) { > super.setEntityManager(em); > } > > @Override public Geo getByAbbreviation(String abbreviation) { > IQuery query = getSession().createQuery("select g from Geo g WHERE g.abbreviation= :abbr"); > //HERE I NEED TO SET THE PARAMETERS for abbreviation > List <Geo> res = query.getResultList(); > return res.get(0); > } > } > > > I am using openEJB with openJPA. Can not use spring or hibernate. > Am I missing something ? > > > Thank you in advance > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Perfectjpattern-users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfectjpattern-users |