-->
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: howto intercept object construction
PostPosted: Tue Oct 05, 2004 8:00 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
Hi,

is there a way to intercept the creation of my persistent domain objects ? I'd like to be able to set some (nonpersistent) properties as soon as a new instance has been created by hibernate (aka : setter based injection).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 8:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
How about a custom implementation of Interceptor.instantiate()


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 9:54 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
thanks steve, that's what I was looking for!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 05, 2004 2:22 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 8:40 pm
Posts: 30
Location: SF Bay Area
Have your class implement net.sf.hibernate.Lifecycle


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 3:29 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
yes, this seems to work as well. But since I dont want to make my domain classes dependent on hibernate (and because some of our domain class are not under our projects control) I cant do that :( .


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 4:27 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Lifecycle is defintely not a good choice in any case (although other ORM solutions still heavily recommend these intrusive interfaces).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.