This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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: 2020
273
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!