I have upgraded my application to Hibernate 3.0.2, mainly to use the getCurrentSession feature. This appears to have had the desired effect: I am albe to insert data in a CMP transaction in WebSphere 5,1 (which this is running in). I have removed all transaction and sesssion management code from my application, and only use the getCurrentSession() method. However within certain transactions there is a need to read data via the QueryImpl class before doing the insert / update, and I am getting a NullPointerException when I invoke
q.list()
in the following line from AbstractQueryImpl
positionalValueSpan += ( (Type) object ).getColumnSpan( session.getFactory() );
I can't see how session would be null, since getCurrentSession() should create one if one does not exist. Any help is appreciated.
Thanks,
Jeff
Hibernate version: 3.0.2
Mapping documents:
Code between sessionFactory.openSession() and session.close():
session = getSessionFactory().getCurrentSession();
Query q = session.createQuery(getQueryString());
bindParameterValues(q, 0);
List l = q.list();
....
protected int bindParameterValues(Query query, int start) throws HibernateException {
if (mCriteria != null && mCriteria.size() > 0) {
// assumes that types are all of span 1
Iterator iter = iterateExpressionEntries();
int result = 0;
while (iter.hasNext()) {
SQLQueryImpl.CriterionEntry ee = (SQLQueryImpl.CriterionEntry)iter.next();
Object[] values = ee.getCriterion().getValues();
Type[] types = ee.getCriterion().getTypes();
for (int i = 0; i < values.length; i++) {
Type type = (i >= types.length) ? types[0] : types[i];
query.setParameter(result + i, values[i], type);
}
result += values.length;
}
return result;
}
else {
return 0;
}
}
Full stack trace of any exception that occurs:
[5/3/05 19:48:03:325 MDT] 226414fc Environment I org.hibernate.cfg.Environment Hibernate 3.0.2
[5/3/05 19:48:03:340 MDT] 226414fc Environment I org.hibernate.cfg.Environment loaded properties from resource hibernate.properties: {hibernate.jdbc.batch_versioned_data=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.cache.region_prefix=hibernate.test, hibernate.proxool.pool_alias=pool1, hibernate.default_batch_fetch_size=8, hibernate.transaction.flush_before_completion=true, hibernate.connection.datasource=jdbc/BAM, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereTransactionManagerLookup, hibernate.jdbc.use_streams_for_binary=true, hibernate.max_fetch_depth=1, hibernate.connection.pool_size=1, WebSphere=datasource, hibernate.transaction.auto_close_session=true, hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider, hibernate.cglib.use_reflection_optimizer=true, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, hibernate.order_updates=true, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect}
[5/3/05 19:48:03:340 MDT] 226414fc Environment I org.hibernate.cfg.Environment using java.io streams to persist binary types
[5/3/05 19:48:03:340 MDT] 226414fc Environment I org.hibernate.cfg.Environment using CGLIB reflection optimizer
[5/3/05 19:48:03:340 MDT] 226414fc Environment I org.hibernate.cfg.Environment using JDK 1.4 java.sql.Timestamp handling
[5/3/05 19:48:03:700 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/ProcessInstance.hbm.xml
[5/3/05 19:48:04:544 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.ProcessInstance -> PROCESSINSTANCE
[5/3/05 19:48:04:653 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/WorkItem.hbm.xml
[5/3/05 19:48:05:137 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.WorkItem -> WORKITEM
[5/3/05 19:48:05:340 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/ProcessInstanceProperty.hbm.xml
[5/3/05 19:48:05:840 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.ProcessInstanceProperty -> PROCESSINSTANCECUSTOMPROPERTY
[5/3/05 19:48:05:840 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/WorkItemProperty.hbm.xml
[5/3/05 19:48:06:309 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.WorkItemProperty -> WORKITEMCUSTOMPROPERTY
[5/3/05 19:48:06:309 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/WorkItemVw.hbm.xml
[5/3/05 19:48:06:794 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.WorkItemVw -> WORKITEM_VW
[5/3/05 19:48:06:794 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration Mapping resource: com/versata/bam/server/ProcessInstanceVw.hbm.xml
[5/3/05 19:48:07:262 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping class: com.versata.bam.server.ProcessInstanceVw -> PROCESSINSTANCE_VW
[5/3/05 19:48:07:262 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration processing extends queue
[5/3/05 19:48:07:262 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration processing collection mappings
[5/3/05 19:48:07:262 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping collection: com.versata.bam.server.ProcessInstance.workItems -> WORKITEM
[5/3/05 19:48:07:262 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping collection: com.versata.bam.server.ProcessInstance.customProperties -> PROCESSINSTANCECUSTOMPROPERTY
[5/3/05 19:48:07:262 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping collection: com.versata.bam.server.WorkItem.customProperties -> WORKITEMCUSTOMPROPERTY
[5/3/05 19:48:07:262 MDT] 226414fc HbmBinder I org.hibernate.cfg.HbmBinder Mapping collection: com.versata.bam.server.WorkItemVw.customProperties -> WORKITEMCUSTOMPROPERTY
[5/3/05 19:48:07:262 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration processing association property references
[5/3/05 19:48:07:262 MDT] 226414fc Configuration I org.hibernate.cfg.Configuration processing foreign key constraints
[5/3/05 19:48:07:294 MDT] 226414fc NamingHelper I org.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[5/3/05 19:48:07:309 MDT] 226414fc DatasourceCon I org.hibernate.connection.DatasourceConnectionProvider Using datasource: jdbc/BAM
[5/3/05 19:48:07:309 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
[5/3/05 19:48:07:309 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory JDBC driver: Oracle JDBC driver, version: 9.2.0.3.0
[5/3/05 19:48:07:356 MDT] 226414fc Dialect I org.hibernate.dialect.Dialect Using dialect: org.hibernate.dialect.Oracle9Dialect
[5/3/05 19:48:07:372 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory JDBC batch size: 15
[5/3/05 19:48:07:372 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory JDBC batch updates for versioned data: enabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Scrollable result sets: enabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory JDBC3 getGeneratedKeys(): disabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Aggressive release : disabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Maximum outer join fetch depth: 1
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Default batch fetch size: 8
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Generate SQL with comments: disabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Order SQL updates by primary key: enabled
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[5/3/05 19:48:07:387 MDT] 226414fc ASTQueryTrans I org.hibernate.hql.ast.ASTQueryTranslatorFactory Using ASTQueryTranslatorFactory
[5/3/05 19:48:07:387 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Query language substitutions: {no='N', true=1, yes='Y', false=0}
[5/3/05 19:48:07:403 MDT] 226414fc TransactionFa I org.hibernate.transaction.TransactionFactoryFactory Transaction strategy: org.hibernate.transaction.JTATransactionFactory
[5/3/05 19:48:07:403 MDT] 226414fc NamingHelper I org.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[5/3/05 19:48:07:419 MDT] 226414fc TransactionMa I org.hibernate.transaction.TransactionManagerLookupFactory instantiating TransactionManagerLookup: org.hibernate.transaction.WebSphereTransactionManagerLookup
[5/3/05 19:48:07:419 MDT] 226414fc TransactionMa I org.hibernate.transaction.TransactionManagerLookupFactory instantiated TransactionManagerLookup
[5/3/05 19:48:07:419 MDT] 226414fc TransactionMa I org.hibernate.transaction.TransactionManagerLookupFactory instantiating TransactionManagerLookup: org.hibernate.transaction.WebSphereTransactionManagerLookup
[5/3/05 19:48:07:419 MDT] 226414fc TransactionMa I org.hibernate.transaction.TransactionManagerLookupFactory instantiated TransactionManagerLookup
[5/3/05 19:48:07:419 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Automatic flush during beforeCompletion(): enabled
[5/3/05 19:48:07:419 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Automatic session close at end of transaction: enabled
[5/3/05 19:48:07:419 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Second-level cache: enabled
[5/3/05 19:48:07:419 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Query cache: disabled
[5/3/05 19:48:07:419 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Cache provider: org.hibernate.cache.EhCacheProvider
[5/3/05 19:48:07:434 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Optimize cache for minimal puts: disabled
[5/3/05 19:48:07:434 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Cache region prefix: hibernate.test
[5/3/05 19:48:07:434 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Structured second-level cache entries: enabled
[5/3/05 19:48:07:465 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Statistics: disabled
[5/3/05 19:48:07:465 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Deleted entity synthetic identifier rollback: disabled
[5/3/05 19:48:07:465 MDT] 226414fc SettingsFacto I org.hibernate.cfg.SettingsFactory Default entity-mode: pojo
[5/3/05 19:48:07:747 MDT] 226414fc SessionFactor I org.hibernate.impl.SessionFactoryImpl building session factory
[5/3/05 19:48:07:887 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.WorkItemVw]; using defaults.
[5/3/05 19:48:08:590 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.ProcessInstanceProperty]; using defaults.
[5/3/05 19:48:08:653 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.ProcessInstance]; using defaults.
[5/3/05 19:48:08:778 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.WorkItemProperty]; using defaults.
[5/3/05 19:48:08:825 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.ProcessInstanceVw]; using defaults.
[5/3/05 19:48:08:919 MDT] 226414fc EhCacheProvid W org.hibernate.cache.EhCacheProvider Could not find configuration [hibernate.test.com.versata.bam.server.WorkItem]; using defaults.
[5/3/05 19:48:09:122 MDT] 226414fc SessionFactor I org.hibernate.impl.SessionFactoryObjectFactory Not binding factory to JNDI, no JNDI name configured
[5/3/05 19:48:09:122 MDT] 226414fc WebSphereTran I org.hibernate.transaction.WebSphereTransactionManagerLookup WebSphere 5.1
[5/3/05 19:48:09:137 MDT] 226414fc SessionFactor I org.hibernate.impl.SessionFactoryImpl Checking 2 named queries
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O workitems0_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O customprop1_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O processins2_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O customprop3_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O workitemvw4_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O processins2_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O workitems0_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O workitemvw4_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O workitems0_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O customprop3_
[5/3/05 19:48:09:512 MDT] 226414fc SystemOut O processins2_
[5/3/05 19:48:10:528 MDT] 1be914f1 WebGroup I SRVE0180I: [ple-viewer-webapp.war] [/ProcessLogicEngine/ple/viewer] [Servlet.LOG]: ProcessViewerServlet: init
[5/3/05 19:48:15:231 MDT] 3e01d4fd WebSphere5Log E com.versata.vis.foundation.time.impl.AlarmManagerImpl sendAlarm TRAS0014I: The following exception was logged java.lang.NullPointerException
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:128)
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:102)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:70)
at com.versata.bam.server.query.SQLQueryImpl.list(SQLQueryImpl.java:339)
at com.versata.bam.ple.audit.WorkItemAccessorLocal.findWorkItem(WorkItemAccessorLocal.java:66)
at com.versata.bam.ple.audit.BAMAuditorImpl.insertOrUpdateWorkItem(BAMAuditorImpl.java:695)
at com.versata.bam.ple.audit.BAMAuditorImpl.stateChanged(BAMAuditorImpl.java:508)
...
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|