-->
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.  [ 6 posts ] 
Author Message
 Post subject: Enhanced objects
PostPosted: Thu Mar 11, 2004 5:43 am 
Newbie

Joined: Thu Mar 11, 2004 5:39 am
Posts: 13
Hi,
I'm a new comer to Hibernate, and I need to clarify a point, sorry if it is a silly question...

Let's say I have a simple bean class that I want to make persistent using Hibernate. If I understand well, the bytecode of my class will be enhanced at runtime. Therefore, hibernate.jar will be needed in my classpath at runtime. Is that correct?

Knowing that, I've been told that it was possible to "unenhance" my object, making it depending no more of hibernate.ar...is that also correct? and if so, how to do that?

thanks a lot for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 5:46 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you want to use Hibernate without having hibernate.jar ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 5:54 am 
Newbie

Joined: Thu Mar 11, 2004 5:39 am
Posts: 13
no...
here is my point:

I have a 3-tiers architecture. my persistent bean class is used in the data tier, and obviously I will have hibernate.jar in the runtime classpath of this tier. however, let's say after having loaded an instance of my bean from the database, I want to send this instance to my presentation layer using serialization for example. And I don't want my presentation runtime classpath to contain hibernate.jar. therefore I think I have to "unenhance" my bean instance before sending it to the presentation layer...

does that make sense?

thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 6:01 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you may use Data Transfer Objet (not persistent) in your presentation layer, the problem is that you'll lose all lazy loading ability...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 6:04 am 
Newbie

Joined: Thu Mar 11, 2004 5:39 am
Posts: 13
I now that. but I try to understand the enhancement mechanism.
Once the objects are enhanced, that need hibernate.jar in my classpath, right?
Is there anyway to get rid of this enhanced code at runtime so I need no more hibernate.jar?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 6:37 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
blecher wrote:
I now that. but I try to understand the enhancement mechanism.
Once the objects are enhanced, that need hibernate.jar in my classpath, right?
Is there anyway to get rid of this enhanced code at runtime so I need no more hibernate.jar?


Hibernate will generate new class for wrapper or will use persistent collection implementation for collections.
It wrapps persistent object for lazy loading and this feature is optional,
if you will unwrapp object you will lose the feature.
If you do not need this feature, just do not use it and your persistent objects will be plain objects without dependancies on hibernate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.