Code:
private void saveNewObjectFromWithinEventListener( Object myObject ) {
try {
InitialContext ctx = new InitialContext();
SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
factory.getCurrentSession().save(myObject);
} catch (NamingException e) {
throw new HibernateException(e);
}
Is this really working for somebody ? If i try this solution in Jboss 4.0.5 EJB3 RC9 inside a post-update-listener, my fresh created Entity will never get persisted in the database when i invoke
Code:
factory.getCurrentSession().save(myObject);
Yes i checked, my update-listener is really invoked within jboss, factory is bound and found in jndi - only the persist does nothing, not even an exception.