Hi Froestel,
First, I want to thank you for your prompt response.
I post here the complet trace, but it doesn't give me any interesting information:
Code:
37 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
40 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
47 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
55 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
150 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
150 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
305 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : mapeos/AppUser.hbm.xml
410 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: erpymesModel.UsersMg.AppUser -> STD_APPUSERS
442 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
517 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
518 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 1
518 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
541 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/erpymes_desarrollo
541 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=ERPYMES, password=****}
1801 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: MySQL, version: 5.1.39-community
1801 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} )
1835 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQL5Dialect
1841 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
1844 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1844 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1844 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1844 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
1844 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
1845 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1845 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1845 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
1847 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
1847 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
1848 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1848 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1849 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
1849 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1855 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1855 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
1855 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
1855 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1855 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1860 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
1861 [main] INFO org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge - Cache provider: org.hibernate.cache.NoCacheProvider
1861 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1861 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
1868 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1869 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1869 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1869 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
1869 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
1950 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
Ocurrió un error en la inicialización de la SessionFactory: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Exception in thread "main" java.lang.NullPointerException
at erpymesModel.UsersMg.MgAppUser.addUser(MgAppUser.java:76)
at erpymesModel.UsersMg.MgAppUser.main(MgAppUser.java:114)
Java Result: 1
I also post the source code related with Hibernate's library.
Code:
private Session _sesion;
private Transaction _tx;
private void iniciaOperacion() throws HibernateException
{
_sesion = HibernateUtil.getSessionFactory().openSession();
_tx = _sesion.beginTransaction();
}
private void manejaExcepcion(HibernateException he) throws HibernateException
{
_tx.rollback();
throw new HibernateException("Ocurrió un error en la capa de acceso a datos", he);
}
....
public int addUser(String userName, String name, String idPerson,
String idClient, String password, String passwordRepeat,
String description, boolean isLocked, Date dateStart, Date dateEnd){
int result = 1;
//TO DO
AppUser newUser = new AppUser(userName, name, password,
description, dateStart, dateEnd, isLocked, idPerson, idClient);
try
{
iniciaOperacion();
result = (Integer) _sesion.save(newUser);
_tx.commit();
} catch (HibernateException he)
{
manejaExcepcion(he);
throw he;
} finally
{
_sesion.close();
}
return result;
}
...
//Main invocation
mg.addUser("usuario","nombre","id","idC","pass","pass","desc",false,dt,dt);
Finally, I post my hibernate's config file and the .hbm file related with my class.
hibernate.cfg.xml:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/erpymes_desarrollo</property>
<property name="connection.username">ERPYMES</property>
<property name="connection.password">ERPYMES</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create-drop</property>
<mapping resource="mapeos/AppUser.hbm.xml" />
</session-factory>
</hibernate-configuration>
AppUser.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="erpymesModel.UsersMg.AppUser" table="STD_APPUSERS">
<id name="userName" column="STD_USERNAME" unsaved-value="-1">
<generator class="assigned"/>
</id>
<property name="_name" column="STD_NAME" not-null="true"/>
<property name="_password" column="STD_PASSWORD" not-null="true"/>
<property name="_description" column="STD_DESCRIPTION"/>
<property name="_dtStart" type="date" column="STD_DT_START" not-null="true"/>
<property name="_dtEnd" type="date" column="STD_DT_END"/>
<property name="_isLocked" column="STD_IS_LOCKED" not-null="true"/>
</class>
</hibernate-mapping>
Thank you very much.