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

Hibernate in a non-managed environment

 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to Hibernate (using Hibernate3). I took a first shot at developing an application in J2SE using Hibernate and had some mixed results. Figuring that it was more due to my lack of understanding of Hibernate, I threw it out and started over using the examples from the Hibernate CaveatEmptor as a starting point. I now have all but that last part finalized.

In particular, I've tried wrapping my DAO method calls (for example, findAll(), makePersistent(), makeTransient(), etc.) in a transaction, but I'm not sure the best way to start and commit the transaction. In my controller code, I don't think I want to have as an example:



I'm looking for suggestions on frameworks for use in a non-managed (no application server) environment for handling transactions. For example, I've tried to use the Command design pattern (GoF) but havent' quite found a way to get that to work.

And as an aside, when I tried to run my application without the beginTransaction calls, I get the following exception:



How can I configure Hibernate not to require transactions?

Thanks.
[ October 18, 2005: Message edited by: David Irwin ]
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking for suggestions on frameworks for use in a non-managed (no application server) environment for handling transactions.


Take a look at the Spring Framework. I haven't had a chance to use it yet, but it looks very promising. It does transaction management.

How can I configure Hibernate not to require transactions?


You can use this Hibernate configuration setting to cause Hibernate to commit after every statement:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic