After insertion,there is no data exists in the USERS table.
Any help is appreciated.
Hibernate version:
3.1alpha1
Mapping documents:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="dms.modual.User" table="USERS">
<id name="id" type="java.lang.Long" column="ID">
<generator class="identity"/>
</id>
<property name="rootFolderId" type="java.lang.Integer" column="ROOT_FOLDER_ID"/>
<property name="rootDeptId" type="java.lang.Integer" column="ROOT_DEPT_ID"/>
<property name="userName" type="java.lang.String" column="USER_NAME" not-null="true" length="100"/>
<property name="password" type="java.lang.String" column="PASSWORD" length="100"/>
<property name="userRank" type="java.lang.Integer" column="USER_RANK"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
UserForm userForm=(UserForm)form;
User user=new User();
user.setUserName(userForm.getUserName());
user.setPassword(userForm.getPassword1());
user.setRootDeptId(new Integer(userForm.getRootDeptId()));
user.setRootFolderId(new Integer(userForm.getRootFolderId()));
user.setUserRank(new Integer(userForm.getUserRank()));
Session dbSession=appSessionFactory.currentSession();
Transaction tx=null;
try{
tx=dbSession.beginTransaction();
dbSession.save(user);
}
catch(Exception ex){
if(tx != null) {
tx.rollback();
}
ex.printStackTrace();
}
finally{
appSessionFactory.closeSession();
}
Full stack trace of any exception that occurs:
No exception,the following logs is useful.
2005-12-08 10:08:46,562 INFO [org.hibernate.util.NamingHelper] - <JNDI InitialContext properties:{}>
2005-12-08 10:08:46,562 INFO [org.hibernate.connection.DatasourceConnectionProvider] - <Using datasource: java:/comp/env/jdbc/DMSJNDI>
2005-12-08 10:08:46,906 INFO [org.hibernate.cfg.SettingsFactory] - <RDBMS: MySQL, version: 5.0.16-nt>
2005-12-08 10:08:46,906 INFO [org.hibernate.cfg.SettingsFactory] - <JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )>
2005-12-08 10:08:46,937 INFO [org.hibernate.dialect.Dialect] - <Using dialect: org.hibernate.dialect.MySQLDialect>
2005-12-08 10:08:46,953 INFO [org.hibernate.transaction.TransactionFactoryFactory] - <Using default transaction strategy (direct JDBC transactions)>
2005-12-08 10:08:46,953 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] - <No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Automatic flush during beforeCompletion(): disabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Automatic session close at end of transaction: disabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <JDBC batch size: 15>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <JDBC batch updates for versioned data: disabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Scrollable result sets: enabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <JDBC3 getGeneratedKeys(): enabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Connection release mode: null>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Maximum outer join fetch depth: 2>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Default batch fetch size: 1>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Generate SQL with comments: disabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Order SQL updates by primary key: disabled>
2005-12-08 10:08:46,953 INFO [org.hibernate.cfg.SettingsFactory] - <Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory>
2005-12-08 10:08:46,968 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] - <Using ASTQueryTranslatorFactory>
2005-12-08 10:08:46,968 INFO [org.hibernate.cfg.SettingsFactory] - <Query language substitutions: {}>
2005-12-08 10:08:46,968 INFO [org.hibernate.cfg.SettingsFactory] - <Second-level cache: enabled>
2005-12-08 10:08:46,968 INFO [org.hibernate.cfg.SettingsFactory] - <Query cache: disabled>
2005-12-08 10:08:46,968 INFO [org.hibernate.cfg.SettingsFactory] - <Cache provider: org.hibernate.cache.EhCacheProvider>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Optimize cache for minimal puts: disabled>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Structured second-level cache entries: disabled>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Echoing all SQL to stdout>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Statistics: disabled>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Deleted entity synthetic identifier rollback: disabled>
2005-12-08 10:08:46,984 INFO [org.hibernate.cfg.SettingsFactory] - <Default entity-mode: pojo>
2005-12-08 10:08:47,140 INFO [org.hibernate.impl.SessionFactoryImpl] - <building session factory>
2005-12-08 10:08:47,140 WARN [net.sf.ehcache.config.Configurator] - <No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/techPrac/DMS/WebApp/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml>
2005-12-08 10:08:47,546 INFO [org.hibernate.impl.SessionFactoryObjectFactory] - <Not binding factory to JNDI, no JNDI name configured>
2005-12-08 10:08:47,546 INFO [org.hibernate.impl.SessionFactoryImpl] - <Checking 0 named queries>
Name and version of the database you are using:
mysql version:5.0.16-nt
The generated SQL (show_sql=true):
insert into USERS (ROOT_FOLDER_ID,ROOT_DEPT_ID,USER_NAME,PASSWORD,USER_RANK) VALUES(?,?,?,?,?)
Debug level Hibernate log excerpt:
INFO
|