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.  [ 2 posts ] 
Author Message
 Post subject: Query For Data That Has Not Been Flushed in Batch Processing
PostPosted: Tue Apr 15, 2008 1:58 pm 
Newbie

Joined: Tue Apr 15, 2008 1:48 pm
Posts: 2
I am using batch processing to persist my data by using flush() and clear() every few hundred records.

I have a query that looks up records to determine if I am doing an insert or update:

Code:
   
Query findQuery = entityManager.createNamedQuery(Constants.NAMED_QUERY_BLS_MAIN_FIND_BY_PIN);
findQuery.setParameter(1, pin);
return (BlsMain) findQuery.getSingleResult();


If I find a record I know it is an insert. The problem is that if in the same batch I save() two records who have a unique PIN the query above does not return a row unless the batch has been flushed already. By turning off batching it works fine since the query will find the already persisted object.

hibernate properties:

Code:
hibernate.jdbc.batch_size 100
hibernate.cache.use_second_level_cache false
hibernate.order_inserts=true
hibernate.order_updates=true


My question is how do I query the entity manager in such a way that I am potentially querying for objects that have not been persisted yet?



Thanks in advance.

Franz Garsombke


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 15, 2008 5:02 pm 
Newbie

Joined: Tue Apr 15, 2008 1:48 pm
Posts: 2
This is not a Hibernate problem. Sorry for wasting your time.


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