Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1.8
Mapping documents:
Code between sessionFactory.openSession() and session.close():
[code]
Transaction tx = HibernateUtil.getSession().beginTransaction();
DynaActionForm dynaForm = (DynaActionForm) form;
empresaVO empresa = new empresaVO();
empresa.setIdEmpresa((Long)dynaForm.get("ID_EMPRESA"));
empresa.setVchnome((String)dynaForm.get("VCHNOME"));
String data = (String)dynaForm.get("DTECADASTRO");
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
empresa.setDtecadastro(sdf.parse(data));
empresa.setVchnomecontato((String)dynaForm.get("VCHNOMECONTATO"));
empresa.setVchfonecontato((String)dynaForm.get("VCHFONECONTATO"));
empresa.setVchfone((String)dynaForm.get("VCHFONE"));
empresa.setVchstatus((String)dynaForm.get("VCHSTATUS"));
EmpresasDAO empresasDAO = new EmpresasDAO();
empresasDAO.insert(empresa);
tx.commit();
HibernateUtil.closeSession();
[code]
[code]
public static Session getSession()
throws DAOException {
Session s = (Session) threadSession.get();
try {
if (s == null) {
log.debug("Opening new Session for this thread.");
s = getSessionFactory().openSession();
log.debug("autocommit = "+s.connection().getAutoCommit());
threadSession.set(s);
}
} catch (HibernateException ex) {
throw new DAOException(ex);
} catch (SQLException ex) {
log.debug("Couldn't set autocommit to false");
throw new DAOException(ex);
}
return s;
}
/**
* Closes the Session local to the thread.
*/
public static void closeSession()
throws DAOException {
try {
Session s = (Session) threadSession.get();
if (s != null && s.isOpen()) {
log.debug("Closing Session of this thread.");
s.close();
threadSession.set(null);
}
} catch (HibernateException ex) {
throw new DAOException(ex);
}
}
[/code]
Name and version of the database you are using: Oracle 8i
The generated SQL (show_sql=true):
WARN [http-8080-Processor23] (ValidSessionFilter.java:45) - ValidSessionFilter Usuario Valido
DEBUG [http-8080-Processor23] (HibernateUtil.java:124) - Opening new Session for this thread.
DEBUG [http-8080-Processor23] (HibernateUtil.java:126) - autocommit = true
INFO [http-8080-Processor23] (EmpresasAction.java:115) - Alterando empresa
DEBUG [http-8080-Processor23] (Dao.java:43) - makePersistent com.bzo2.lupo.vo.empresaVO
DEBUG [http-8080-Processor23] (HibernateUtil.java:146) - Closing Session of this thread.