Hello,
I already encountered a problem in Part 1 of the Introduction to Hibernate. (
http://www.hibernate.org/hib_docs/v3/re ... orial.html) I couldn't hardly imagine that this problem wasn't answered somewhere else on the web, but after 2 hours of searching I see no other solution than to post this probably very easy problem.
I have simply copy-pasted all the code from Part 1 of the mentioned tutorial.
However I get the following error:
Assignment of a NULL value to a NOT NULL column.
Full output:
12:27:28,221 INFO Environment:514 - Hibernate 3.2.6
12:27:28,252 INFO Environment:547 - hibernate.properties not found
12:27:28,268 INFO Environment:681 - Bytecode provider name : cglib
12:27:28,268 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
12:27:28,362 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
12:27:28,362 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml
12:27:28,830 INFO Configuration:559 - Reading mappings from resource : events/Event.hbm.xml
12:27:28,908 INFO HbmBinder:300 - Mapping class: events.Event -> DB2ADMIN.EVENTS
12:27:28,955 INFO Configuration:1547 - Configured SessionFactory: null
12:27:29,127 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
12:27:29,127 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
12:27:29,143 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
12:27:29,205 INFO DriverManagerConnectionProvider:80 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: JDBC:DB2:DATABASENAME
12:27:29,205 INFO DriverManagerConnectionProvider:86 - connection properties: {user=USERNAME, password=****}
12:27:31,096 INFO SettingsFactory:89 - RDBMS: DB2/NT, version: 08.02.0002
12:27:31,096 INFO SettingsFactory:90 - JDBC driver: IBM DB2 JDBC 2.0 Type 2, version: 08.02.0003
12:27:31,127 INFO Dialect:152 - Using dialect: org.hibernate.dialect.HSQLDialect
12:27:31,127 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
12:27:31,127 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
12:27:31,127 INFO SettingsFactory:143 - Automatic flush during beforeCompletion(): disabled
12:27:31,127 INFO SettingsFactory:147 - Automatic session close at end of transaction: disabled
12:27:31,127 INFO SettingsFactory:154 - JDBC batch size: 15
12:27:31,127 INFO SettingsFactory:157 - JDBC batch updates for versioned data: disabled
12:27:31,127 INFO SettingsFactory:162 - Scrollable result sets: enabled
12:27:31,127 INFO SettingsFactory:170 - JDBC3 getGeneratedKeys(): disabled
12:27:31,127 INFO SettingsFactory:178 - Connection release mode: auto
12:27:31,143 INFO SettingsFactory:205 - Default batch fetch size: 1
12:27:31,143 INFO SettingsFactory:209 - Generate SQL with comments: disabled
12:27:31,143 INFO SettingsFactory:213 - Order SQL updates by primary key: disabled
12:27:31,143 INFO SettingsFactory:217 - Order SQL inserts for batching: disabled
12:27:31,143 INFO SettingsFactory:386 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:27:31,143 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
12:27:31,143 INFO SettingsFactory:225 - Query language substitutions: {}
12:27:31,143 INFO SettingsFactory:230 - JPA-QL strict compliance: disabled
12:27:31,143 INFO SettingsFactory:235 - Second-level cache: enabled
12:27:31,143 INFO SettingsFactory:239 - Query cache: disabled
12:27:31,143 INFO SettingsFactory:373 - Cache provider: org.hibernate.cache.NoCacheProvider
12:27:31,143 INFO SettingsFactory:254 - Optimize cache for minimal puts: disabled
12:27:31,143 INFO SettingsFactory:263 - Structured second-level cache entries: disabled
12:27:31,143 INFO SettingsFactory:283 - Echoing all SQL to stdout
12:27:31,143 INFO SettingsFactory:290 - Statistics: disabled
12:27:31,143 INFO SettingsFactory:294 - Deleted entity synthetic identifier rollback: disabled
12:27:31,143 INFO SettingsFactory:309 - Default entity-mode: pojo
12:27:31,143 INFO SettingsFactory:313 - Named query checking : enabled
12:27:31,221 INFO SessionFactoryImpl:161 - building session factory
12:27:31,768 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
12:27:31,784 INFO SchemaExport:154 - Running hbm2ddl schema export
12:27:31,784 DEBUG SchemaExport:170 - import file not found: /import.sql
12:27:31,784 INFO SchemaExport:179 - exporting generated schema to database
12:27:31,799 DEBUG SchemaExport:303 - drop table DB2ADMIN.EVENTS if exists
12:27:31,815 DEBUG SchemaExport:288 - Unsuccessful: drop table DB2ADMIN.EVENTS if exists
12:27:31,815 DEBUG SchemaExport:289 - [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "if exists" was found following "able DB2ADMIN.EVENTS". Expected tokens may include: "<space>". SQLSTATE=42601
12:27:31,815 DEBUG SchemaExport:303 - create table DB2ADMIN.EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID))
12:27:32,627 INFO SchemaExport:196 - schema export complete
Hibernate: insert into DB2ADMIN.EVENTS (EVENT_ID, EVENT_DATE, title) values (null, ?, ?)
12:27:39,112 WARN JDBCExceptionReporter:77 - SQL Error: -407, SQLState: 23502
12:27:39,112 ERROR JDBCExceptionReporter:78 - [IBM][CLI Driver][DB2/NT] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=83, COLNO=0" is not allowed. SQLSTATE=23502
Hope someone can help me.