• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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.
 
Bartender
Posts: 2089
276
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!