• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to ignore some database errors in a Hibernate Session  RSS feed

 
Greenhorn
Posts: 8
Java Mac OS X Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been searching all evening for a good solution, but I'm still lost.

Our server receives a large amount of data from a client, in the form of a Hibernate Business Object, with a lot of children.
If the main entity succeeds, the children are less important.

The problem I now have, is that if something goes wrong while storing one of the children, I want to ignore the problem and continue with the rest.

If a Hibernate Exception occurs, I can't rollback the session to the last flush, because it will rollback everything, including the main entity.
I also can't continue, because I will get a message "don't flush the Session after an exception occurs" and all other actions on the session will be ignored.

One alternative would be using a StatelessSession, but this would require a lot of rework in the code, and I'm not sure this is the solution.

I think that posting the code won't be helpful, because the code is complex and this problem is not specific to the code.

We're still using jboss 4.2.3 and hibernate 3.3.1.
 
Saloon Keeper
Posts: 1929
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is a Hibernate Business Object a JPA annotated POJO?
 
Dennis van Beek
Greenhorn
Posts: 8
Java Mac OS X Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, this project does not use JPA (this project is a bit older). We use normal POJO's, with XDoclet.
 
Don't touch me. And dont' touch this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!