As I understand it, then your second email is correct. If you don't run the
getting and updating of your components in a transaction, your Entity gets
decoupled (JPA default behavior is to decouple the Entities outside of a
transaction), so it will not save any updates done outside of the
transaction.

On Wed, Apr 2, 2008 at 2:38 PM, Nino Saturnino Martinez Vazquez Wael <
[EMAIL PROTECTED]> wrote:

> Hmm thinking over this again. I thought that after you persisted
> something, JPA would handle it for you. So what you are saying are that if I
> get a object from the persistance manager, and then update something
> directly on the POJO i would then have to begin a transaction and commit it?
>
> So just binding using a compoundmodel I would have to have a tx begin and
> commit in the submit method of the form?
>
> Like this:
>
> public void onSubmit() {
> tx.begin;
> tx.commit?
>                                      }
>                              };
>
>
>
>
> Meindert Deen wrote:
>
> > my 2 cents, don't know if this is your problem:
> > The transaction based entity manager only commits if the update of the
> > data
> > is within a transaction.  So you must wrap your  update in a transaction
> > (you said you used Spring, so you can configure this in your Spring xml
> > or
> > use the annotation based transactions.)
> >
> > Hope this helps,
> >
> > Meindert
> >
> > On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael <
> > [EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I know this is not completely related. But here goes anyway.
> > >
> > > I have an application with several different flows. If I switch from
> > > extended to transaction, suddenly the values in my form aren't save to
> > > the
> > > database(but they are saved in memory), I use spring to instantiate
> > > entitymanager and inject. It's very strange that it does not work.
> > >
> > > I believe that the difference between expanded and transaction based
> > > entity manager are something todo with if it's request or session
> > > based
> > > right? I would actually have thought the error to show the other way
> > > around.
> > >
> > > Heres some code of my forms, I use  the compoundpropertymodel:
> > >
> > >      add(new TextField("lifts").add(NumberValidator.POSITIVE));
> > >      add(new TextField("weight").add(NumberValidator.POSITIVE));
> > >
> > > Button btnUpdate = new Button("updateRep", new Model("updateRep")) {
> > >       @Override
> > > public void onSubmit() {
> > > //make a roundtrip so JPA saves the changes
> > >                                       }
> > >                               };
> > >
> > > And web.xml:
> > >
> > >       <context-param>
> > >               <param-name>contextConfigLocation</param-name>
> > >               <param-value>classpath:zeuzContext.xml</param-value>
> > >       </context-param>
> > >
> > >
> > >       <filter>
> > >               <filter-name>openEntityManagerInViewFilter</filter-name>
> > >               <filter-class>
> > >
> > >  org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
> > >               </filter-class>
> > >       </filter>
> > >
> > >
> > >       <filter-mapping>
> > >               <filter-name>openEntityManagerInViewFilter</filter-name>
> > >               <url-pattern>/*</url-pattern>
> > >       </filter-mapping>
> > >
> > >       <listener>
> > >               <listener-class>
> > >
> > >  org.springframework.web.context.ContextLoaderListener
> > >               </listener-class>
> > >       </listener>
> > >       <filter>
> > >               <filter-name>zeuzGroupApplication</filter-name>
> > >               <filter-class>
> > >                       org.apache.wicket.protocol.http.WicketFilter
> > >               </filter-class>
> > >               <init-param>
> > >                       <param-name>applicationClassName</param-name>
> > >                       <param-value>
> > >
> > > zeuzgroup.application.ZeuzGroupApplication
> > >                       </param-value>
> > >               </init-param>
> > >       </filter>
> > >
> > >       <filter-mapping>
> > >               <filter-name>zeuzGroupApplication</filter-name>
> > >               <url-pattern>/zeuz/*</url-pattern>
> > >       </filter-mapping>
> > >
> > >
> > >
> > > --
> > > -Wicket for love
> > >
> > > Nino Martinez Wael
> > > Java Specialist @ Jayway DK
> > > http://www.jayway.dk
> > > +45 2936 7684
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> >
> >
> >
>
> --
> -Wicket for love
>
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to