• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TransactionRequiredException in Hibernate

 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

I have a bit of a problem. In my code, I execute an insert query using entityManager.createNativeQuery(query).executeUpdate() to insert 1000 records at a time into the database. On my development machine, it works perfectly. In the live environment, it throws an exception;


Any idea what could be causing it? Perhaps a setting or something somewhere? We use Hibernate, Glassfish 2.1 and MySQL on both my development machine and the live server. I'm stumped, and any help will be much appreciated.

Many thanks,
Riaan

 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For future reference, we have tracked down the issue.

We had a not-null field in the live database which didn't have have a value in the insert query. It's an old field which was no longer used, and though I had already removed it from my database, it was still in the live database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic