You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Holloway <bi...@gmail.com> on 2007/06/20 02:11:05 UTC

T5 hibernate: Illegal attempt to assoc. collection w/ 2 open sessions.

I have a Person entity (hibernate mapped) that can own multiple
"items".  I'm using a bean edit form on the variable _item in the
following:

during setRender, I do

_item = new Item();
_item.setOwner(person);

In my save method, I have

onSubmit ()
{
  _dao.saveOrUpdate (_item);
}

I then get the error in the subj line of this e-mail.  Any ideas?

Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 hibernate: Illegal attempt to assoc. collection w/ 2 open sessions.

Posted by Bill Holloway <bi...@gmail.com>.
Going back to fully-nonmanaged hibernate.  My DAOs now look like

Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do something.
tx.commit();
}
catch (RuntimeException e) {
if (tx != null) tx.rollback();
throw e;
}
finally {
sess.close();
}

Works just fine.

On 6/19/07, Bill Holloway <bi...@gmail.com> wrote:
> I have a Person entity (hibernate mapped) that can own multiple
> "items".  I'm using a bean edit form on the variable _item in the
> following:
>
> during setRender, I do
>
> _item = new Item();
> _item.setOwner(person);
>
> In my save method, I have
>
> onSubmit ()
> {
>   _dao.saveOrUpdate (_item);
> }
>
> I then get the error in the subj line of this e-mail.  Any ideas?
>
> Bill
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org