This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 2354
293
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.
 
What a show! What atmosphere! What fun! What a tiny ad!
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!