Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Non transactional with hibernate

 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a question, is there a way to use hibernate with a non transactional database?

Thanks
 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This I am not sure of but you could go here to see a list of databases that are currently supported:

http://hibernate.org/80.html

Which db did you have in mind?
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, im using informix, it is supported and in the transactional databases it works fine, but could not make it work in non transactional, has anyone tried it and made it work?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Hibernate with Informix and I haven't had any issues with transactions.

What do you mean by non-transactional? Are you trying to avoid explicitly beginning/committing a transaction?

Hibernate does support auto-commit.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, i have two databases in informix that were created using the nontransactional option, (they dont use transactions even if you want) so everything is autocommit and you cant roll back. But it seems that hibernate has problems dealing with this kind of schema.
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how to keep Hibernate from calling commit() other than to create your own transaction and transaction factory classes. That would allow you to intercept the transaction calls and skip them.

See the source to org.hibernate.transaction.JDBCTransactionFactory and JDBCTransaction as examples.

An entry in the Hibernate configuration file would tell Hibernate to use your factory:

hibernate.transaction.factory_class = org.hibernate.transaction.NonTransactionalTransactionFactory
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic