• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jboss transactions and hibernate

 
kelly goedert
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using jboss 4.0.1 and hibernate 2.1

I have a stateless session bean which accesses a DAO class which has hibernate code to insert, update... I noticed that if in this DAO class I use hibernate transactions, with transaction.begin() and transaction.commit() when the transaction.commit() line is executed the database is not updated.
Why that happens? Shouldn't the data be commited to the database when commit is executed?

Other thing I tried was to use JBoss' UserTransaction class but it also didn't work. How can I be sure that when the transaction.commit() is executed the database is really updated?

Thank you

Kelly.
 
Venkatraman Kandaswamy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just starting on hibernate and while reading the book your post came to my mind. Here is the quote from Hibernate in action

Hibernate executes SQL statements asynchronously. An INSERT statement isn't usually executed when the application calls Session.save(); an update isn't immediately issued when the application calls Item.addBid(). Insted, the SQL statements are usually issued at the end of a transaction. This behavior is called write-behind
 
kelly goedert
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,
I agree. In my understanding the transaction.commit() would do that, or the session.flush(). But the database is not being updated in the transaction.commit() or in the session.flush().
Why that happens?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic