-->
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.  [ 3 posts ] 
Author Message
 Post subject: Session flushing despite FlushMode=NEVER (OSIV Filter)
PostPosted: Thu Nov 15, 2007 10:13 am 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
My web application uses Hibernate 3.2 and Spring, and is configured to use an OpenSessionInViewFilter with the default FlushMode (FlushMode.NEVER).

It appears that the session is being flushed automatically, however, whenever I fetch some data using Criteria.

This means that if I want to create entity instances for use in the view only, I'm restricted. With the following code, "myEntity" would be written to the database on line 2 where there's a call to findByCriteria(...)

Code:
1: myEntity = new EntityObject();
2: getHibernateTemplate().findByCriteria(some detached criteria);


Is this the expected behaviour?

I realise that I could avoid "myEntity" being written to the database by swapping lines 1 and 2, but in my scenario that's not possible as I have custom JSP tags that fetch data using the criteria API.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 11:36 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
You are setting the flushmode to never? The default flush mode is AUTO.

_________________
Some people are like Slinkies - not really good for anything, but you still can't help but smile when you see one tumble down the stairs.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 11:42 am 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
VampBoy wrote:
You are setting the flushmode to never? The default flush mode is AUTO.


My mistake, I am not overriding the default. I just thought it was NEVER.


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