Any help apreciated...:)

These lines should take care of transaction wrapping right?:

From my spring xml:

   <bean id="txManager"
       class="org.springframework.orm.jpa.JpaTransactionManager">
       <property name="entityManagerFactory"
           ref="entityManagerFactory" />
   </bean>
   <tx:annotation-driven transaction-manager="txManager" />

And in my dao class:

@Transactional
public class DBDaoImpl implements IDBDao, InitializingBean {
.. Methods..

}

Or should I annotate each method in the class also?



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