I have a problem that is causing me quite a bit of grief. I am developing in WSAD 5.0 (jdk1.3) and deploying to a HPUx WebSphere environment running WAS 5.1.1.1 (jdk1.4). It seems that for whatever reason, I have a retrieval that returns nothing when run on my server. The local test environment runs just fine, returning the entire object graph of data beans that I expect. The behavior, at least on the outside looks like it does the select and doesn't find anything on the server. But after looking at the logs, it looks like Hibernate never actually executes any SQL (see below in the Hibernate debug logs). I am not that familiar yet with Hibernate, so I'm not sure if I'm missing something. But I also notice in the log that the BatcherImpl is never hit. I'm assuming this is where the SQL is prepared stmts etc. are actually executed.
Sorry for the large amounts of info below, just trying to follow the rules here. Any help or suggestions is appreciated. I can and will also supply more logs etc. if needed.
Thanks
--randy
Hibernate version: 2.1.4
Mapping documents:
<hibernate-mapping>
<class
name="BillBean"
table="CL_EB_BILL"
dynamic-insert="true"
dynamic-update="true">
<id
name="billIdty"
type="java.lang.Integer"
column="BILL_IDTY"
unsaved-value="null">
<column name="BILL_IDTY" unique="true" />
<generator class="identity" />
</id>
Spring config:
Using Spring declarative txn management
<!--Transaction Proxy Template -->
<bean id="ebill.txProxyTemplate" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="ebill.transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
Code between sessionFactory.openSession() and session.close():
My code in a DAO, called by a delegate class that has declarative txn wrapped around it
public BillBean search(final Integer billId) {
final int pk = billId.intValue();
List beans =
getHibernateTemplate()
.createCriteria(this.getSession(false), BillBean.class)
.setFetchMode("lineBeans", FetchMode.EAGER)
.add(Expression.eq("billIdty", new Integer(pk)))
.list();
return beans.isEmpty() ? null : (BillBean) beans.get(0);
}
Full stack trace of any exception that occurs:
No exception, that's the wierd thing about it
Name and version of the database you are using:
dB2 v7.2 OS390
The generated SQL (show_sql=true):
The generated sql is huge. It is doing a join between 7 or 8 tables with all columns. I can provide if required. But there is really nothing special about the sql AFAIK.
Debug level Hibernate log excerpt:
Here is for the local environment that works...
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.transaction.JDBCTransaction - begin
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.transaction.JDBCTransaction - current autocommit status:true
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.transaction.JDBCTransaction - disabling autocommit
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.SessionImpl - Dont need to execute flush
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.SQL - select this.BILL_IDTY as BILL_IDTY5_, this.FK_HEAD_IDTY as ..... there is a lot more here..... linebeans5_.REVENUE_CD as REVENUE_CD4_ from T301DBA.CL_EB_BILL this left outer join T301DBA.CL_EB_HEAD headerbean1_ on this.FK_HEAD_IDTY=headerbean1_.HEAD_IDTY left outer join T301DBA.CL_EB_PROV providerbe2_ on this.FK_PROV_IDTY=providerbe2_.PROV_IDTY left outer join T301DBA.CL_EB_SUBS subscriber3_ on this.FK_SUBS_IDTY=subscriber3_.SUBS_IDTY left outer join T301DBA.CL_EB_CLAIMANT claimantbe4_ on this.FK_CLMT_IDTY=claimantbe4_.CLMT_IDTY left outer join T301DBA.CL_EB_LINE linebeans5_ on this.BILL_IDTY=linebeans5_.FK_BILL_IDTY where this.BILL_IDTY=?
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-10-22 12:55:32,365 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.type.IntegerType - binding '74' to parameter: 1
2004-10-22 12:55:32,537 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.loader.Loader - processing result set
2004-10-22 12:55:32,537 [Servlet.Engine.Transports : 0] DEBUG net.sf.hibernate.type.IntegerType - returning '90' as column: HEAD_IDTY0_
This is for the server env that does not work, notice there is not SQL generated
[Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
2004-10-22 12:49:21,542 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.transaction.JDBCTransaction - begin
2004-10-22 12:49:21,543 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.transaction.JDBCTransaction - current autocommit status:true
2004-10-22 12:49:21,543 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.transaction.JDBCTransaction - disabling autocommit
2004-10-22 12:49:21,601 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
2004-10-22 12:49:21,607 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
2004-10-22 12:49:21,608 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
2004-10-22 12:49:21,608 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
2004-10-22 12:49:21,608 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2004-10-22 12:49:21,608 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2004-10-22 12:49:21,612 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.impl.SessionImpl - Dont need to execute flush
2004-10-22 12:49:21,616 [Servlet.Engine.Transports : 3] DEBUG net.sf.hibernate.transaction.JDBCTransaction - commit
|