-->
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: Best Practise for dealing with Working Drafts
PostPosted: Thu Mar 10, 2005 2:31 pm 
Newbie

Joined: Sat Feb 12, 2005 9:26 am
Posts: 3
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:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 8:31 am 
Newbie

Joined: Sat Feb 12, 2005 9:26 am
Posts: 3
ok, ok....

with saveOrUpdateCopy
it's working fine !!


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.