-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: InvocationTargetException
PostPosted: Tue Mar 13, 2007 10:55 pm 
Newbie

Joined: Mon Mar 12, 2007 4:42 am
Posts: 2
Hi,

I'm developing a J2EE application with EJB and Hibernate in JBoss.

The Member class is POJO, whose assignGroup method may throw InvalidGroupException.

public class Member {
...
public void assignGroup(String group) throws InvalidGroupException {
...
}
}

In an EJB method, it loads a Member object from Hibernate session then call the assignGroup method. Naturally, it has to catch InvalidGroupException.

Member member = (Member) session.load(Member.class, memberID);
try {
member.assignGroup(group);
} catch(InvalidGroupException ex) {
...
}

When I test it by assigning an invalid group, it cannot catch InvalidGroupException. Instead, java.lang.reflect.InvocationTargetException is thrown. InvalidGroupException is wrapped inside the InvocationTargetException, i.e. InvocationTargetException.getCause() gives InvalidGroupException.

Is that Hibernate uses a different mechanism of exception handling?

Thanks for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.