Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3beta4
Mapping documents:
Code:
<session-factory>
...
<listener type="load" class="com.eyrolles.sportTracker.event.SportTrackerLoadListener"/>
</session-factory>
Code between sessionFactory.openSession() and session.close():using HibernateUtil (maybe important)
Full stack trace of any exception that occurs:that's the problem just after listener, session is closed without any exception occuring
Name and version of the database you are using:HSQLDB
The generated SQL (show_sql=true):not important
Debug level Hibernate log excerpt:Code:
public class SportTrackerLoadListener extends DefaultLoadEventListener {
public Object onLoad(LoadEvent event, LoadEventListener.LoadType loadType)
throws HibernateException {
System.out.println("testEvent");
Object o = null;
try{
System.out.println("eventTest");
}
catch (Exception e){
e.printStackTrace();
}
return super.onLoad(event, loadType);
}
}
Code:
public void testJoin() throws Exception {
initData();
Session session = HibernateUtil.getSession();
Transaction tx=null;
try {
tx = session.beginTransaction();
// here session is still connected
// the listener is activated, i can see my println in the console but just after, the debugger jump into the finally block ;(
EhancedTeam t = (EhancedTeam)session.get(EhancedTeam.class,new Long(1));
System.out.println(t.getCoachName());
tx.commit();
}
catch (Exception e) {
e.printStackTrace();
if (tx!=null) tx.rollback();
throw e;
}
finally {
session.close();
System.out.println
}
}
why, when using my listener, the finally block is reached without intercepting any exception?
I must miss something, or done something wrong... but i don't see what...