-
1. Re: Using createCriteria in booking example
marius.oancea Nov 18, 2005 6:24 AM (in response to nusa)Are you using noejb ?
-
2. Re: Using createCriteria in booking example
nusa Nov 18, 2005 6:48 AM (in response to nusa)"marius.oancea" wrote:
Are you using noejb ?
No, the above code is taken from the booking example, not the noejb example. -
3. Re: Using createCriteria in booking example
gavin.king Nov 18, 2005 7:47 AM (in response to nusa)Use Property.forName("username") instead of Property.forName("this.username").
-
4. Re: Using createCriteria in booking example
nusa Nov 18, 2005 7:57 AM (in response to nusa)"gavin.king@jboss.com" wrote:
Use Property.forName("username") instead of Property.forName("this.username").
Did that, but still got the same error. -
5. Re: Using createCriteria in booking example
patrick_ibg Nov 18, 2005 9:36 AM (in response to nusa)( (HibernateEntityManager) em ).getSession().
Instead of doing this, try changing
@PersistenceContext
private EntityManager em ;
to
@PersistenceContext
private Session session ; -
6. Re: Using createCriteria in booking example
nusa Nov 18, 2005 9:58 AM (in response to nusa)"patrick_ibg" wrote:
( (HibernateEntityManager) em ).getSession().
Instead of doing this, try changing
@PersistenceContext
private EntityManager em ;
to
@PersistenceContext
private Session session ;
Thanks, the error is gone.
So, is there something wrong with HibernateEntityManager ? -
7. Re: Using createCriteria in booking example
patrick_ibg Nov 18, 2005 11:07 AM (in response to nusa)Nope, the problem is that JBoss wraps the HibernateEntityManager with another implementation.
Alternatively, you can inject@PersistenceContext EntityManager em ;
As you did originally. Then to get the session:protected Session getSession () { return ((org.jboss.ejb3.entity.HibernateSession) em).getHibernateSession() ; }
-
8. Re: Using createCriteria in booking example
gavin.king Nov 18, 2005 5:23 PM (in response to nusa)The trouble here is that JBoss EJB3 is providing its own interface that does exactly the same thing that a HEM interface does. I've asked Bill to change to use the HEM interface in EJB3.
-
9. Re: Using createCriteria in booking example
patrick_ibg Nov 18, 2005 6:07 PM (in response to nusa)Hopefully that makes it in. As it is, I need to keep separate Session and EntityManager fields in my Dao classes, depending on whether I use them w/in JBoss or J2SE.
-
10. Re: Using createCriteria in booking example
tylerdurden001 Mar 14, 2006 7:47 AM (in response to nusa)Hi Mr. Gavin King,
do you have an answer from Bill for the HEM interface in EJB3?
regards