Hello
my Problems is the generel dealing with "working Drafts" from SerializationHelper and their persisting with Hibernate 2.1.8.
For explanation:
The involved Application is Webbased and there i handle with working drafts as a copy of persistence Objects (ObjectA,..) to make manipulations and things, and then later deside to save or not.
Because its a web-app and i have this "back-button"-Problem, therefore i once load the Object (ObjectA) and make a "working draft", if the user now clicks "back-button" he will still get the orginal-Objects-Datas.
For duplication/cloning i use SerializationHelper ....
and then I try to persist this manipulated-duplication....
in the same session ....
but..it's not working ...
... HibernateException
...
... i don't know how get this work !!!
Do you have a good tip :)
thx
Hibernate version:
2.18
Mapping documents:
Object A
has one-many Bag C1
with one-many Bag(lazy=true) C2
of Object B
Code between sessionFactory.openSession() and session.close():
...
Session session=sessionToSessionMap.get(httpSession);
if (session==null)
{
session=sessionFactory.openSession();
sessionToSessionMap.put(httpSession,session);
//(one-per-httpSession)
}
ObjectA oa=(ObjectA)session.load(ObjectA.class,new Integer(id));
//build working draft for webuser (back-button-inconsistence-protection):
ObjectA oa_clone=SerializationHelper.clone(oa);
...
//user change on working draft
oa.clone.getC1s().add(new C1());
oa.clone.setName("clone");
...
//Ok, lets save this working draft.
...
///----session.clear(); ??? --------------------<<<<<<<<--- ???????
session.update(oa);
session.flush();
session.disconnect();
...
getSession
Full stack trace of any exception that occurs:
[currently N/A,but coming ...]
Remembering:
- ... A Object with same identifier has ... with this session....
- ...
Name and version of the database you are using:
mysql 4
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
|