-->
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: How to not retrieve deleted objects in the session?
PostPosted: Wed Jul 10, 2013 5:58 pm 
Newbie

Joined: Sat Oct 07, 2006 2:48 pm
Posts: 17
I am facing this problem.

I have a method who do many things and persist a lot of data. This method is also read only, using a parameter i set the flush method to manual to never persist changes. When the method first runs it create the data, and it is all ok. But after i run this method again as a read only, to achieve the same effect as the first one i need to delete all files it created before, for example, this method creates the week payment for many persons based on the week payments made in the month, if a person has to pay 1000 in the month, and the month has 4 four week, we have:

month amount less payments made divided with left weeks of the month
week 1 = (1000 - 0) / 4 = 250
week 2 = (1000-250) / 3 = 250
week 3 = (1000-500) / 2 = 250
week 4 = (1000-750) / 1 = 250

if i run the method on the week 3, it creates the payment ok. The way i get the paid amount is fetching all payments and do a sum of each payment for every person. When i run again the week 3, i set the flush method to manual, i delete all payments of this week and using the same algorithm to get the paid amonth, but the problem is that hibernate returns the 3 payment entities for each person (even i have delete one).

My question is, can i achieve the funtionality that i want or i forgot the idea?

This is just one example of what the method does, it also modified other entities, create other ones, etc. Basically the method delete and update every entity to get back to the original status, but even this hibernate returns the data as in the data base.

thank you for your time.


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.