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/23 06:50:10 UTC

T5 Creating new hibernate persistent entity via beaneditform

Here's another tap-hibernate issue.  I have a page to create a new
CreditCardInfo to then store into hibernate.  The CreditCardInfo is
many-to-one with Person.

I have a page w/ a non-persistent property _creditCardInfo.  The
beaneditform creates/shows its blank creditCardInfo just fine.  Form
handler looks like

OtherPage onSuccessFromCreditCardForm ()
{
  _creditCardInfo.setOwner (_state.getLoggedInPerson());
  _creditCardDAO.saveOrUpdate (_creditCardInfo);
  return _otherPage; // injected
}

The saveOrUpdate call gets me the illegal attempt to assoc. a
collection with 2 open sessions.  I've tried multiple combinations of
activation contexts, persistent _creditCardId properties, etc.

Anybody else having luck with this kind of task under tap-hibernate?

Bill

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


Re: T5 Creating new hibernate persistent entity via beaneditform

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm thrilled you figured this out, I haven't had any spare cycles to
go deeper on the hibernate integration end of things.

On 6/22/07, Bill Holloway <bi...@gmail.com> wrote:
> Problem seems to be solved by the following calls in onSuccess...
>
> _creditCardDAO.saveOrUpdate(_creditCardBean);
> _creditCardBean.setOwner(_state.getLoggedInPerson());
> _creditCardDAO.merge(_creditCardBean);
>
> The call to merge being the magic incantation.
>
> bill
>
> On 6/22/07, Bill Holloway <bi...@gmail.com> wrote:
> > Here's another tap-hibernate issue.  I have a page to create a new
> > CreditCardInfo to then store into hibernate.  The CreditCardInfo is
> > many-to-one with Person.
> >
> > I have a page w/ a non-persistent property _creditCardInfo.  The
> > beaneditform creates/shows its blank creditCardInfo just fine.  Form
> > handler looks like
> >
> > OtherPage onSuccessFromCreditCardForm ()
> > {
> >   _creditCardInfo.setOwner (_state.getLoggedInPerson());
> >   _creditCardDAO.saveOrUpdate (_creditCardInfo);
> >   return _otherPage; // injected
> > }
> >
> > The saveOrUpdate call gets me the illegal attempt to assoc. a
> > collection with 2 open sessions.  I've tried multiple combinations of
> > activation contexts, persistent _creditCardId properties, etc.
> >
> > Anybody else having luck with this kind of task under tap-hibernate?
> >
> > Bill
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: T5 Creating new hibernate persistent entity via beaneditform

Posted by Bill Holloway <bi...@gmail.com>.
Problem seems to be solved by the following calls in onSuccess...

_creditCardDAO.saveOrUpdate(_creditCardBean);
_creditCardBean.setOwner(_state.getLoggedInPerson());
_creditCardDAO.merge(_creditCardBean);

The call to merge being the magic incantation.

bill

On 6/22/07, Bill Holloway <bi...@gmail.com> wrote:
> Here's another tap-hibernate issue.  I have a page to create a new
> CreditCardInfo to then store into hibernate.  The CreditCardInfo is
> many-to-one with Person.
>
> I have a page w/ a non-persistent property _creditCardInfo.  The
> beaneditform creates/shows its blank creditCardInfo just fine.  Form
> handler looks like
>
> OtherPage onSuccessFromCreditCardForm ()
> {
>   _creditCardInfo.setOwner (_state.getLoggedInPerson());
>   _creditCardDAO.saveOrUpdate (_creditCardInfo);
>   return _otherPage; // injected
> }
>
> The saveOrUpdate call gets me the illegal attempt to assoc. a
> collection with 2 open sessions.  I've tried multiple combinations of
> activation contexts, persistent _creditCardId properties, etc.
>
> Anybody else having luck with this kind of task under tap-hibernate?
>
> Bill
>

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