Hi i have a problems with hibernate, i think that there are problems with transactions..i have already read this
http://hibernate.org/42.html but it did not helped me..
why when i do a statement as a insert it does not work and i get a java null pointer exception?
this is the java code
Code:
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction tx = session.getTransaction();
tx.commit();
session.save(a_user_object);
session.close();
this is the log
Code:
....
15:25:40,125 INFO NamingHelper:26 - JNDI InitialContext properties:{}
15:25:40,125 INFO DatasourceConnectionProvider:61 - Using datasource: java:/comp/env/database
15:25:40,828 INFO SettingsFactory:89 - RDBMS: MySQL, version: 5.0.51b-community-nt
15:25:40,828 INFO SettingsFactory:90 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.5 ( Revision: ${svn.Revision} )
15:25:40,906 INFO Dialect:152 - Using dialect: org.hibernate.dialect.MySQLDialect
15:25:40,906 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
15:25:40,921 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15:25:40,921 INFO SettingsFactory:143 - Automatic flush during beforeCompletion(): disabled
15:25:40,921 INFO SettingsFactory:147 - Automatic session close at end of transaction: disabled
15:25:41,000 INFO SettingsFactory:154 - JDBC batch size: 15
15:25:41,000 INFO SettingsFactory:157 - JDBC batch updates for versioned data: disabled
15:25:41,015 INFO SettingsFactory:162 - Scrollable result sets: enabled
15:25:41,015 INFO SettingsFactory:170 - JDBC3 getGeneratedKeys(): enabled
15:25:41,015 INFO SettingsFactory:178 - Connection release mode: auto
15:25:41,015 INFO SettingsFactory:202 - Maximum outer join fetch depth: 2
15:25:41,015 INFO SettingsFactory:205 - Default batch fetch size: 1
15:25:41,109 INFO SettingsFactory:209 - Generate SQL with comments: disabled
15:25:41,109 INFO SettingsFactory:213 - Order SQL updates by primary key: disabled
15:25:41,109 INFO SettingsFactory:217 - Order SQL inserts for batching: disabled
15:25:41,109 INFO SettingsFactory:386 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:25:41,125 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
15:25:41,125 INFO SettingsFactory:225 - Query language substitutions: {}
15:25:41,203 INFO SettingsFactory:230 - JPA-QL strict compliance: disabled
15:25:41,203 INFO SettingsFactory:235 - Second-level cache: enabled
15:25:41,203 INFO SettingsFactory:239 - Query cache: disabled
15:25:41,203 INFO SettingsFactory:373 - Cache provider: org.hibernate.cache.NoCacheProvider
15:25:41,203 INFO SettingsFactory:254 - Optimize cache for minimal puts: disabled
15:25:41,203 INFO SettingsFactory:263 - Structured second-level cache entries: disabled
15:25:41,218 INFO SettingsFactory:283 - Echoing all SQL to stdout
15:25:41,296 INFO SettingsFactory:290 - Statistics: disabled
15:25:41,296 INFO SettingsFactory:294 - Deleted entity synthetic identifier rollback: disabled
15:25:41,312 INFO SettingsFactory:309 - Default entity-mode: pojo
15:25:41,312 INFO SettingsFactory:313 - Named query checking : enabled
15:25:41,453 INFO SessionFactoryImpl:161 - building session factory
15:25:42,203 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
Hibernate: insert into tblusers (username, pw, email, role, active) values (?, ?, ?, ?, ?)
15:25:42,531 ERROR UserManager:54 - java.lang.NullPointerException
i don't understand why it doesn't work..
thanks