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.  [ 4 posts ] 
Author Message
 Post subject: class loading dilemma
PostPosted: Wed Jun 07, 2006 3:35 pm 
Newbie

Joined: Wed Jun 07, 2006 3:16 pm
Posts: 2
Hi folks

I am in the hell of class loading, and need some serious help. I have the following application layout:

tomcat/shared/lib/
class A (need access to POJO)

webapp1/
POJO java class
hibernate3.1 and the rest of third party jars

webapp2/
class C (need access to A)

My questions are:

(1) do I must put POJO (generated java file by hibernate) in webapp1/ ? because I don't (and put POJO jars into shared loading space, I saw many Error on BasicLazyInitializer, CGLIB Enhancement failed .... combined with NoClassDefFoundEorr: org/hiberante/proxy/HibernateProxy, I couldn't really pinpoint the reason.)

(2) if I put POJO into webapp1, then above errors are gone, but since Class A needs access to POJO and putting Class A into webapp1 is NOT an option for me, that means I have to put POJO into shared loading space as well, which seems very WRONG. And it tomcat logs does report it violates loading constraints.

What are my options then? any help? (btw- this is with tomcat 4.1.x)

Thanks

Oliver


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 07, 2006 3:47 pm 
Regular
Regular

Joined: Mon May 22, 2006 2:30 pm
Posts: 74
It sounds like what you are doing is returning Hibernate persistent objects to your client, which you should not be doing. From your description, it appears that some object with a persistent collection associated with it was returned. Don't do that. Hibernate replaces the standard java collections with Hibernate implementations, and they will be sucked along with the parent object and sent to the client.

What you need to do is use a Data Transfer Object design pattern. Create classes that serve solely as data containers to ship results back to the client. Do not expose your O-R persistence layer to the client layer.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 07, 2006 11:53 pm 
Newbie

Joined: Wed Jun 07, 2006 3:16 pm
Posts: 2
Thanks for the reply.
I realized that exposing this O/R might be a bad idea.
Any pointers on further guidence on this?

Thanks

Oliver


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 08, 2006 3:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
place hibernate3.jars on the "client" or use a DTO as explained.

_________________
Max
Don't forget to rate


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

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.