-->
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: OpenSessionInViewFilter vs LockMode.NONE
PostPosted: Fri Apr 15, 2005 3:43 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Hi all,

I got hit with the infamous LazyInitializationException. The problem is that we have one very common method in our code base:

public Object findById(Class entityClass, Long id) {
Object result =
getHibernateTemplate().get(entityClass, id);
try {
getSession().evict(result);
} catch (HibernateException e) {
throw convertHibernateAccessException(e);
}
return result;
}

The problem is with the evict() call. We have an OpenSessionInViewFilter. I tried solving the problem via only XML, as referenced here:

http://www.jroller.com/page/kbaum/20040708

Unfortunately I was not successful.

Using session.lock(object, LockMode.NONE); solves the problem, but is a bit intrusive on the code base.

Question: Given the evict() call, is it possible to solve the problem with only the xml configuration of Spring? Would hibernateInterceptor help here?

iksrazal


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.