This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Hibernate JPA persist() not throwing EntityExistsException

 
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have an EJB project where I am using a SessionBean (stateless) to persist an item, the problem I am having is, when an item is added with the same primary key value, the method is supposed to throw a EntityExistException, but it is not throwing any exception, instead the caller is thrown a EJBException, I am calling this Session Bean from a different Web project. I tried adding try/catch block in the EJB to check what exception is thrown. The catch bloack doesn't get executed even when catching the generic Exception object. I am using container managed persistence? Could you please help me out with this please. Regards
[ May 17, 2008: Message edited by: Ransika deSilva ]
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The catch bloack doesn't get executed even when catching the generic Exception object.



Try just catching the RuntimeException, rather than the generic Exception object. You might find the true exception that is being thrown from your Hibernate3 code.

-Cameron McKenzie
 
Get off me! Here, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic