• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate (JPA) - Exception Handling

 
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

I'm writing a service (only a POJO that implements an interface that is injected by Spring 2 in my JSF 1.2 ManagedBeans).
My service, have an EntityManaged injected by Spring via @PersistenceContext annotation (I'm not using DAOs interface).

Well, the point is: I'd like to make foundations to decide the best way to handle the EntityManager exceptions in my service.

I'm posting my code as follows and I'd like to discuss if this is a good way or there is another way that can be more efficiently.
At this example, my method saveUser throws RegistryException that is an abstract Exception related to my service that will
encapsulate low level exceptions that may occur inside it when using my entitymanager instance or when business divergences
occurs.



Thanks in advance.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic