Hi all.
Maybe i missed some info ..
This code was inside a standard T5 page, with a hibernate session injected.

It's curious , because i find no reason for the code not to be commited, it's even not giving errors ... not even a rollback.

Ups...Sorry Jose i didn't notice u were using the @CommitAfter inside
ur components.


On Tue, Jul 21, 2009 at 10:55 PM, Howard Lewis Ship<hls...@gmail.com> wrote:
On Tue, Jul 21, 2009 at 12:19 PM, Juan E. Maya<maya.j...@gmail.com> wrote:
Hi Jose,

did u remember configure the HibernateTransactionAdviser as described
at the bottom of:
http://tapestry.apache.org/tapestry5/tapestry-hibernate/userguide.html
The advisor is only necessary when using @CommitAfter with your own
*services*.  The @CommitAfter annotation works with *components*
automatically.

?


On Tue, Jul 21, 2009 at 9:13 PM, jose luis
sanchez<joseluis.sanc...@m-centric.com> wrote:
Hello all.

I'm experiencing weird problems with the @CommitAfter tag ...

Have a hibernate schema, a configuration, and everything ok ( it runs ,
checked ), now, the only WAY of getting a data to be persisted into database
is using a transaction, like this

  @OnEvent(component="addCustomer",value="success")
  Object onSuccess() {
      Customer customer = (Customer) theSession.get(Customer.class,
theSubscription.getId());
      if (customer != null) {
          Transaction tx = theSession.beginTransaction();
          theSession.update(customer);
          tx.commit();
      }
      return null;
  }


Previously, the following did work, but it's not working now .. it just says
ok, it returns a generated Id , ( as seen in logs ) , but does not persist
the info in the table.
  @OnEvent(component="addCustomer",value="success")
  @CommitAfter
  Object onSuccess() {
      Customer customer = (Customer) theSession.get(Customer.class,
theSubscription.getId());
      if (customer != null) {
          theSession.update(customer);
      }
      return null;
  }


The bean is a java bean ( no Tapestry annotation at all, just the hbm.xml
file , unchanged )
Any help ?


My relevant information from hibernate.cfg
May the transaction factory have anything to do with the problem ?

      <!--  Session configurations -->
      <property
name="hibernate.current_session_context_class">thread</property>
      <property
name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

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


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



--
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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



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



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

Reply via email to