-->
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: Reuse of an object reference in the same session?
PostPosted: Fri Jul 06, 2007 7:17 am 
Newbie

Joined: Wed May 31, 2006 12:58 pm
Posts: 14
Hello everybody,

I'd have a simple question:
May I do the following?
Code:
MyClass myObject  = new MyClass();
myObject.setSomething("something");
session.save(myObject );

// and now load some other entity
myObject = session.load(MyClass.class, new Long(12345));
myObject.setAnotherSomething("another something");

session.flush();


I.e., use the myObject variable to referebce different objects in the same Hibernate session?

Thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 7:29 am 
Beginner
Beginner

Joined: Mon Nov 13, 2006 9:43 am
Posts: 30
Hi,

I would say I see no reason why you may NOT do this...


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.