I have just started evaluating Hibernate and am trying to set up a slightly modified version of the example in the Quick Start with Tomcat section of documentation. Here is what I have:
public class HibernateUtil exactly as in example (
here)
Code:
public class HibernateWork {
public static void execute () {
try {
Session session = HibernateUtil.currentSession();
Transaction tx= session.beginTransaction();
HibernateExUser newUser = new HibernateExUser(); //standard JavaBean
newUser.setUsername("User1");
newUser.setFirstName("The First");
newUser.setFirstName("User");
newUser.setUserId(0);
session.save(newUser);
tx.commit();
HibernateUtil.closeSession();
} catch (HibernateException e) {
e.printStackTrace();
}
}
}
This is the output (seems to read configurations okay):
Code:
Mar 9, 2004 1:46:21 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.2
Mar 9, 2004 1:46:21 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Mar 9, 2004 1:46:21 PM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Mar 9, 2004 1:46:22 PM net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Mar 9, 2004 1:46:22 PM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Mar 9, 2004 1:46:23 PM net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: user.fr.hbm.xml
Mar 9, 2004 1:46:25 PM net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.plexsci.foo.HibernateExUser -> usersex
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Mar 9, 2004 1:46:27 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.SQLServerDialect
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
Mar 9, 2004 1:46:27 PM net.sf.hibernate.util.NamingHelper getInitialContext
INFO: JNDI InitialContext properties:{}
Mar 9, 2004 1:46:27 PM net.sf.hibernate.connection.DatasourceConnectionProvider configure
INFO: Using datasource: java:comp/env/jdbc/SQLServer/foo
Mar 9, 2004 1:46:27 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Mar 9, 2004 1:46:27 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.ehcache.hibernate.Provider
I have my debugger on and the code steps through the first line (Session object creation), and into the static code of the HibernateUtil class, but does not reach any other code in my application. Obviously, no object gets stored in the database, because no object is ever created in memory as far as I can tell. No exceptions are thrown or reported. Can anyone tell me what might be going on? Why is nothing happening beyond the configuration?