Page 1 of 1

Data not saving in the database

Posted: Fri Jul 06, 2012 1:14 am
by AnuKV
Hai

I am new to this framework. I am studying the Broadleaf code and trying to make a similar application.
In my DAO class, the em.merge() statement does not save data into the database. It does not give any error, but does not save anything in the database.
I am using MySql database. I created new table and trying to save the values.
Could you please suggest me in what direction should I approach this problem?
I think there is something related to transaction that I am missing.

Thanks and Regards
Anu

Re: Data not saving in the database

Posted: Tue Jul 10, 2012 6:19 pm
by pokemon007
This could be due to lack of transaction associated with the method. You can verify it by calling em.commit() after em.merge(), and it'll throw no transaction exception.

Re: Data not saving in the database

Posted: Thu Jul 19, 2012 10:17 am
by aazzolini
You likely need to set up AOP around that method to get it to actually persist.

Something like this, but obviously geared towards your classes.

Code: Select all

   <aop:config>
      <aop:pointcut id="blOrderMultishipOption" expression="execution(* org.broadleafcommerce.core.order.dao.OrderMultishipOptionDao.save*(..))"/>
       <aop:advisor advice-ref="blTxAdvice" pointcut-ref="blOrderMultishipOption"/>
   </aop:config>

Re: Data not saving in the database

Posted: Mon Jul 30, 2012 1:03 am
by AnuKV
Thanks a lot
Its working now.