-->
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.  [ 9 posts ] 
Author Message
 Post subject: how to make a transient object associated with a session?
PostPosted: Mon Apr 19, 2004 4:48 am 
Newbie

Joined: Tue Apr 13, 2004 12:02 am
Posts: 12
how to make a transient object associated with a new session?

i try session.replicate(obj) and session.instantiate(Class clazz, Serializable id)., but both failed!

So any guy has any ideal?

cheers,
glen


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 4:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you mean a detatched object, use session.lock(object, LockMode.NONE)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 5:01 am 
Newbie

Joined: Tue Apr 13, 2004 12:02 am
Posts: 12
it is a transient object, not PO.
So lock method won't be working!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 5:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Please be more clear. A transient object is a newly created object in our terms. To associate it with a session, you do a session.save(object) of course.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 5:25 am 
Newbie

Joined: Tue Apr 13, 2004 12:02 am
Posts: 12
hi, Sorry for vague message!

Of course a transient object is a newly created object .

my concerned is why i still cannot get a PO by SessionImplementor.instantiate(Class clazz, Serializable id) ?

And except session.save(object), is there another way to associate object with a session?

thanks help, anyway!

cheers,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 6:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What is your problem with .save ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 6:25 am 
Newbie

Joined: Tue Apr 13, 2004 12:02 am
Posts: 12
.save is working fine!

i just wonder how to associate a newly create obj with session withour insert it in DB.

And there is session.evict() method to remove association. but no method to rebuild it!

moreover, SessionImplementor.instantiate( ) sounds Ok. but it failed too.

It really make me puzzled!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 6:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is no such state as "non-persistant but connected to a Session" with Hibernate, there is either transient = "non-peristant, not connected to a Session", transactional = "persistant, connected to a Session" or detatched = "persistant, not connected to a Session".


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 6:59 am 
Newbie

Joined: Tue Apr 13, 2004 12:02 am
Posts: 12
ok, got it
thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.