-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4071563
By: cmaniac
Can anybody help me with this issue?
We are starting a project with zk+hibernate, first of all we have everything configurated, I mean the project is runnig (still under development) and it goes well.. until.., well I resume de problem:
we have a window which we have to edit elements from it's Master and details, well it seems that when we first consult the master and its details (both fully registered in hibernate cfg = hbm+bean and the master has a set of details) zk bring them right away, then we try to save a reference en the class Master for later modifications, but when de user edits one of it's details later, seems that hibernate lost reference over the master and do not execute any sql to maintain the set of details synchronaized with the database, we did some tests about it and if we make modifications in the same method in which we query the master, hibernate MAKE! all the sql to be synchronaized with the database, then we supose that the transaction in this case is over so, hibernate can't deal with this...
please help how can we maintain the set of details without re-query the Master and without to have execute remove the object of the set and then delete..
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4074649
By: igx89
Have you given http://www.zkoss.org/smalltalks/hibernatezk/hibernatezk.dsp a look?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4075261
By: cmaniac
thanks..
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4075527
By: cmaniac
I read the smalltalk (and thanks for de info):
Hibernate + ZK
Henri Chen, Principal Engineer, Potix Corporation September 14, 2006
but, it didn't help me at all., I mean, we have all the configurations in our project that is mentioned in the article. but in the document they forgot to mention something about "set" properties, you know some type of collection of objects (Master and a set of details) which is the problem I explained before...
other ideas??
in adition, at mi last message: we want to take advantage of hibernate capacities of persist a master-detail class (master Class + set of details), in which, if we make a remove, add, modify of an object in the hashset of master class collection, hibernate automatically synchronizes this with data base. in other words we don't have DAO's,
we appreciate any help...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4075598
By: cmaniac
well I have a clue
reading some hibernate articles, I found something that fits my own issue, it seems that zk closes the transaction when finish some event method and return the control to zk, well in hibernate there are something called "deatached objects"
or something like that (there are a lots of documentation about it), so....
to deal with my issue I have to reatach my master object to thee new session and obviously the new transaction... and thats all... well I did this and works
fine:
1. first I need the hibernate session
import org.zkoss.zkplus.hibernate.HibernateUtil;
import org.hibernate.classic.Session;
...
Session _session = HibernateUtil.getSessionFactory().getCurrentSession();
2. reatach my master class with
_session.lock(<Object>, LockMode.NONE);
reading de documentation I found two method for this task "lock" and "update", I choose lock and goes well.
thanks,
Asked: 2006-12-22 13:48:52 +0800
Seen: 413 times
Last updated: Dec 27 '06