Reading the EJB 3.0 documentation it should be simply obtained by casting the EntityManager instance.

org.hibernate.Session session = (org.hibernate.Session)entityManager;

However, there seems to be a problem with JBoss AS 5.0, because a ClassCastException is issued.

You can use the the getDelegate() method of the entity manager to avoid this problem:

org.hibernate.Session session = (org.hibernate.Session)entityManager.getDelegate();

 

0
0
0
s2smodern

JBoss recipe of the day

0
0
0
s2smodern

W

i

l

d

F

l

y

 

c

h

e

a

t

s

h

e

e

t