-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate / JBoss / EJB+JAX-RS Issue
PostPosted: Fri Sep 13, 2013 8:02 am 
Newbie

Joined: Fri Sep 13, 2013 7:47 am
Posts: 1
I've come across elements of these problems in various google searches but I've been at it so long now my brain is starting to melt.

Using: JBoss 7.1.1 (and the bundled Hibernate + Resteasy), running on Java 6.

We have the following elements split across multiple maven modules:

[server-common] (JAR)
StudyRemote (@Remote EJB interface)

[server-beans] (JAR)
persistence.xml
StudyBean (@Stateless implementation of StudyRemote interface)

[website] (WAR)
IStudyAPI (interface JAX-RS annotations and @Local)
StudyAPI (@Stateless implementation of IStudyAPI)

in essence, the StudyBean/StudyRemote act as a DAO.

We have two possible deployment scenarios:
1) server-common, server-beans and website are all bundled into an EAR file
2) server-common and server-beans are bundled into an EAR and website.war is deployed afterwards

Under both scenarios, the issue is that I'm getting LazyInitializationException in the StudyAPI methods. It seems the hibernate session is only lasting as long as the method calls within the StudyBean. That is, getStudy(id) will return a Study entity, but then trying to access lazy members does not work.

Ideally I'd like all of the EntityManager work to be done within the StudyBean implementation (i.e. I'd like to try and avoid EntityManager references in the StudyAPI implementation) but have the hibernate session exist for the duration of an HTTP call such that I can access the lazy members of the objects returned by the StudyBean methods. Is there some kind of explicit demarcation I can do?

I'm hoping the issue is one I can read up on and learn the hows and whys of glueing together these components, I'm just a bit deluged with information when I google the issue :(

Thanks,
Derek


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.