Yes. Hibernate sessions re cheap, however, though it would be nice to keep some of the session validity a teensy bit longer to get more caching value out of the L1 cache. But what you say is true, and .merge() is probably what you need here.

Christian.

On 22-Oct-07, at 6:50 AM, Angelo Chen wrote:


Hi Lasitha,

Thanks for the link, but what's the conclusion? Tapestry-hibernate has to be updated to close the session? there seems no decision in that thread. I use
now merge which get rid of the problem so far. I'm new to this T5 form
handling, if I understand correctly: onActivate the session was opened
because a object is retrieved, then automatically close. onSuccess another
session was opened because of call to update/merge, am I right here?
A.C.


lasitha wrote:

http://thread.gmane.org/gmane.comp.java.tapestry.user/53095/focus=53170
Cheers, lasitha.

On 10/22/07, Angelo Chen <[EMAIL PROTECTED]> wrote:

Hi,

I have code like following, but it generate an exception when form
submits,
i thought there is only one Session open and usr is a detached instance,
any
hints on how to fix this? thanks.

A.C.

Illegal attempt to associate a collection with two open sessions


@Persist
private Usr usr;


@Inject
private Session _session;

public Class onActivate(Long id) {
       usr = (Usr)_session.get(Usr.class, id);
}

String onSuccess() {
       _session.saveOrUpdate(usr);
        return null;
}


--
View this message in context:
http://www.nabble.com/T5%3A-how-to-use-a-detached-hibernate-object-in-a-form--tf4669657.html#a13339389
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
View this message in context: 
http://www.nabble.com/T5%3A-how-to-use-a-detached-hibernate-object-in-a-form--tf4669657.html#a13340586
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to