tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chawax <olivier.thie...@gmail.com>
Subject Re: PersistenceContext and Hibernate session
Date Fri, 11 Jul 2008 14:16:12 GMT

Yes, Hibernate is not part of JPA (even though JPA is based on concepts
created by Hibernate). But it can be used as a JPA implementation, then it
adds features to JPA ones (criterias for example).
I think my problem is that org.hibernate.Session does not implement
javax.persistence.EntityManager, so it looks like OpenEJB is right when it
throws an error about this ;)

I found there's a org.hibernate.ejb.HibernateEntityManager that implements
javax.persistence.EntityManager, I think I should use this one instead of
org.hibernate.Session. I'm going to test this.


Martin Vysny-2 wrote:
> 
> On Fri, 2008-07-11 at 06:50 -0700, chawax wrote:
>> Hi,
>> 
>> In my application, I have two persistence contexts for the same
>> persistence
>> unit, one for JPA, the other for Hibernate :
>> 
>>     /**
>>      * Inject persistence context t4Seam     
>>      */
>>     @javax.persistence.PersistenceContext(unitName = "t4Seam")    
>>     protected javax.persistence.EntityManager emanager;
>> 
>>     /**
>>      * Inject Hibernate Session
>>      */
>>     @javax.persistence.PersistenceContext(unitName = "t4Seam")    
>>     protected org.hibernate.Session hibernateSession;
>> 
>> It used to work with JBoss. But with OpenEJB, I have the following error:
>> "Use of @PersistenceContext only applies to EntityManager references"
>> 
>> Is it intented or is it a bug ?
>> 
>> Olivier
> 
> I think it's intended: Hibernate API is not part of JPA/EJB3
> specification afaik.
> 
> Martin
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/PersistenceContext-and-Hibernate-session-tp18404318p18404898.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message