I've setup JBoss according to the instructions at
http://www.hibernate.org/66.html.
Now I have a couple of questions:
1. Do I have to call session.flush() at the end of each method in my session beans?
If I don't do it, SQL inserts are executed, but not SQL updates.
I'm thinking I may have done something wrong - the best thing would be if I never had to call flush().
2. Does it matter if I close the session or not?
Best Regards,
Filip
Example code:
Code:
public void savePerson(Person person) {
Session session = hibernateHelper.openSession();
try {
System.out.println("savePerson(): "+person);
session.saveOrUpdate(person);
System.out.println("pre flush()");
session.flush();
System.out.println("post flush()");
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new EJBException("savePerson() failed", e);
} finally {
hibernateHelper.closeSession(session);
}
}