-->
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: The Lifecycle interface and Hibernate 3
PostPosted: Thu Jun 19, 2008 11:49 am 
Newbie

Joined: Thu Jun 19, 2008 11:08 am
Posts: 1
Hi all,

my current task at work is to update our e-commerce application DAO layer from H2 to H3. For this task I really appreciated your "Migration Guide" and want to thank you very much for doing so.
But I have a problem with the current (old) code that uses the H2 Lifecycle interface in this way (example code):
Code:
public class ExampleEntity implements Serializable, Lifecycle {

protected SessionFactory sessionFactory;
...

public void onLoad(Session session, Serializable arg1) {
sessionFactory = session.getSessionFactory();
}

....

public Float getPrice() {
if (this.price == null) {
Session session = SessionFactoryUtils.getSession(sessionFactory, false);
Query query = session.createQuery("....");
...
price  = query.uniqueResult();
}
return this.price;
}

}

where SessionFactoryUtils is a Spring helper class that offers transparent hibernate session handling but it doesn't matter in this context.

Following the "migration guide" i have to use an interceptor and I agree that it can work. Please can confirm me that the only(or the best) way to convert my existing code (I have different entities that implement the deprecated Lifecycle interface as on the code fragment above) to H3 is to use org.hibernate.Interceptor?

Thank you very much.

Indrit


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.