Hello,
We're starting with Java (Hibernate) to connect to our databases on Iseries (DB2). Connection is OK. The problem is writing and updating to the tables on As/400.
Following errors occurs : Is this a problem related on our database or did we forgot some Hibernate properties. Can anyone help me out than I will post the code of a simple table.
Here is the errrorlog : 0 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA 0 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1 0 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 0 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 15 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 46 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA 46 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA 218 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: be.hoedlmayr.cursus.jpa.Person 250 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity be.hoedlmayr.cursus.jpa.Person on table H_BEDTA.PERSONS 281 [main] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring 281 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 328 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!) 328 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20 328 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: true 343 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.ibm.as400.access.AS400JDBCDriver at URL: jdbc:as400://****:****/***** 546 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=*****, password=****, autocommit=true, release_mode=auto} 812 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: DB2 UDB for AS/400, version: 05.04.0000 V5R4m0 812 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: AS/400 Toolbox for Java JDBC Driver, version: 8.11 828 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.DB2400Dialect 828 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory 828 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 828 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto 828 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 828 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 828 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory 828 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {} 828 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: enabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 828 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout 828 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled 828 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo 828 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled 859 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory 968 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured 968 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update 968 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata 1000 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema 2984 [main] INFO org.hibernate.tool.hbm2ddl.DatabaseMetadata - table not found: H_BEDTA.PERSONS 3125 [main] INFO org.hibernate.tool.hbm2ddl.DatabaseMetadata - table not found: H_BEDTA.PERSONS 3140 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: create table H_BEDTA.PERSONS (PERSIDNR integer generated by default as identity, PERSFIRS varchar(255), PERSLAST varchar(255), primary key (PERSIDNR)) 3140 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - [SQL0601] PERSONS in H_BEDTA type *FILE already exists. 3140 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Warning: -99999, SQLState: 01H10 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - Extra URL elements are ignored. 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Warning: -99999, SQLState: 01H20 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - Extra connection property is ignored. 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Warning: 1301, SQLState: HY001 3140 [main] WARN org.hibernate.util.JDBCExceptionReporter - [PWS0082] 1 bibliotheken niet toegevoegd aan lijst van bibliotheken. Hibernate: insert into H_BEDTA.PERSONS (PERSIDNR, PERSFIRS, PERSLAST) values (default, ?, ?) 3218 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: -407, SQLState: 23502 3218 [main] ERROR org.hibernate.util.JDBCExceptionReporter - [SQL0407] Null values not allowed in column or variable PERSIDNR. Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not insert: [be.hoedlmayr.cursus.jpa.Person] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226) at be.hoedlmayr.cursus.jpa.SavePerson.main(SavePerson.java:25) Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [be.hoedlmayr.cursus.jpa.Person] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220) ... 1 more Caused by: java.sql.SQLException: [SQL0407] Null values not allowed in column or variable PERSIDNR. at com.ibm.as400.access.JDError.throwSQLException(JDError.java:646) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:617) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1581) at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:227) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1937) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:524) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.prepare(IdentityGenerator.java:90) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:54) ... 16 more
|