I performed the following query with no records returned
select * from voicemail_users where pager is null
This query returned all of the rows
select * from voicemail_users where pager = ''
Here's the SQL that describes the table
Code:
CREATE TABLE `voicemail_users` (
`uniqueid` int(11) NOT NULL auto_increment,
`customer_id` int(11) NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` varchar(20) NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) default NULL,
`pager` varchar(50) NOT NULL default '',
`stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`uniqueid`),
KEY `mailbox_context` (`mailbox`,`context`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Here's the dump with the extra log4j information
Code:
18:36:23,921 INFO Environment:479 - Hibernate 3.1.2
18:36:23,936 INFO Environment:509 - hibernate.properties not found
18:36:23,936 INFO Environment:525 - using CGLIB reflection optimizer
18:36:23,936 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
18:36:24,014 INFO Configuration:1308 - configuring from resource: /hibernate.cfg.xml
18:36:24,014 INFO Configuration:1285 - Configuration resource: /hibernate.cfg.xml
18:36:24,124 INFO Configuration:469 - Reading mappings from resource: com/emergent_netsolutions/pbx/VoicemailUsers.hbm.xml
18:36:24,233 INFO HbmBinder:309 - Mapping class: com.emergent_netsolutions.pbx.VoicemailUsers -> VOICEMAIL_USERS
18:36:24,264 INFO Configuration:1419 - Configured SessionFactory: null
18:36:24,358 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
18:36:24,358 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
18:36:24,358 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
18:36:24,358 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/emergentpbx?zeroDateTimeBehavior=convertToNull&emptyStringsConvertToZero=false
18:36:24,358 INFO DriverManagerConnectionProvider:86 - connection properties: {user=root, password=****}
18:36:24,655 INFO SettingsFactory:77 - RDBMS: MySQL, version: 5.0.20-nt
18:36:24,671 INFO SettingsFactory:78 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
18:36:24,686 INFO Dialect:103 - Using dialect: org.hibernate.dialect.MySQLDialect
18:36:24,702 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
18:36:24,702 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
18:36:24,702 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
18:36:24,702 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
18:36:24,702 INFO SettingsFactory:136 - JDBC batch size: 15
18:36:24,702 INFO SettingsFactory:139 - JDBC batch updates for versioned data: disabled
18:36:24,702 INFO SettingsFactory:144 - Scrollable result sets: enabled
18:36:24,702 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): enabled
18:36:24,702 INFO SettingsFactory:160 - Connection release mode: auto
18:36:24,702 INFO SettingsFactory:184 - Maximum outer join fetch depth: 2
18:36:24,702 INFO SettingsFactory:187 - Default batch fetch size: 1
18:36:24,702 INFO SettingsFactory:191 - Generate SQL with comments: disabled
18:36:24,702 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
18:36:24,702 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
18:36:24,717 INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
18:36:24,717 INFO SettingsFactory:203 - Query language substitutions: {}
18:36:24,717 INFO SettingsFactory:209 - Second-level cache: enabled
18:36:24,717 INFO SettingsFactory:213 - Query cache: disabled
18:36:24,717 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.NoCacheProvider
18:36:24,717 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
18:36:24,717 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
18:36:24,717 INFO SettingsFactory:257 - Echoing all SQL to stdout
18:36:24,717 INFO SettingsFactory:264 - Statistics: disabled
18:36:24,733 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
18:36:24,733 INFO SettingsFactory:283 - Default entity-mode: pojo
18:36:24,764 INFO SessionFactoryImpl:153 - building session factory
18:36:25,186 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
18:36:25,202 INFO SessionFactoryImpl:728 - closing
18:36:25,202 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:mysql://localhost/emergentpbx?zeroDateTimeBehavior=convertToNull&emptyStringsConvertToZero=false
Hibernate: select voicemailu0_.UNIQUEID as UNIQUEID0_, voicemailu0_.customer_id as customer2_0_, voicemailu0_.context as context0_, voicemailu0_.mailbox as mailbox0_, voicemailu0_.password as password0_, voicemailu0_.fullname as fullname0_, voicemailu0_.email as email0_, voicemailu0_.pager as pager0_, voicemailu0_.STAMP as STAMP0_ from VOICEMAIL_USERS voicemailu0_
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
Hibernate: update VOICEMAIL_USERS set customer_id=?, context=?, mailbox=?, password=?, fullname=?, email=?, pager=?, STAMP=? where UNIQUEID=?
18:36:25,827 WARN JDBCExceptionReporter:71 - SQL Error: 1263, SQLState: 22004
18:36:25,827 ERROR JDBCExceptionReporter:72 - Column set to default value; NULL supplied to NOT NULL column 'pager' at row 1
18:36:25,842 ERROR AbstractFlushingEventListener:299 - Could not synchronize database state with session
org.hibernate.exception.DataException: could not update: [com.emergent_netsolutions.pbx.VoicemailUsers#47]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:75)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2222)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:361)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.emergent_netsolutions.pbx.VoicemailUsersManager.getAllVoiceMailUsers(VoicemailUsersManager.java:103)
at com.emergent_netsolutions.pbx.VoicemailUsersManager.main(VoicemailUsersManager.java:42)
Caused by: java.sql.BatchUpdateException: Column set to default value; NULL supplied to NOT NULL column 'pager' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:642)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
... 13 more
org.hibernate.exception.DataException: could not update: [com.emergent_netsolutions.pbx.VoicemailUsers#47]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:75)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2222)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:361)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.emergent_netsolutions.pbx.VoicemailUsersManager.getAllVoiceMailUsers(VoicemailUsersManager.java:103)
at com.emergent_netsolutions.pbx.VoicemailUsersManager.main(VoicemailUsersManager.java:42)
Caused by: java.sql.BatchUpdateException: Column set to default value; NULL supplied to NOT NULL column 'pager' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:642)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
... 13 more
Exception in thread "main"
Since I'm new to hibernate, I'm not sure why when I'm only trying to read, does it think that the records are dirty.
Also, if I'm not using the
Session dom4jSession = session.getSession(EntityMode.DOM4J);
and just get a standard session instead of the dom4jSession I can commit and it doesn't get this error. When I changed this to the dom4jSession, that's when this error started.
Thanks for your help.