• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate (JPA) - Exception Handling

 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic