I'm using hibernate from w/i JBoss. When I invoke the SP, it seems to execute ok, but mapping the data from the resultset back into Hibernate fails miserably. The ddl_* SPs simply return a resultset and take no parameters. Though there is always a RETURN_RESULT from a SP, I'm discarding it.
Down below in my mapping document, you'll note there are no return-property statements. They are:
<return-property name="FieldId" column="field_id"/>
<return-property name="FieldName" column="field_name"/>
and if I include, them, I get the error. If I remove them, the error goes away.
Why?
Hibernate configuration:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="HbmSessFactoryFinancialCrimes">
<!-- Settings for a JBoss-managed connection -->
<property name="connection.provider_class">org.hibernate.connection.DatasourceConnectionProvider</property>
<property name="connection.datasource">java:/FinancialCrimesInquiry</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="transaction.flush_before_completion">true</property>
<property name="transaction.auto_close_session">true</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<!--
be sure to set deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml
to TRUE, otherwise, Hibernate will generate odd-errors
<attribute name="UseJBossWebLoader">true</attribute>
-->
<!-- Disable second-level cache. -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="cache.use_query_cache">false</property>
<property name="cache.use_minimal_puts">false</property>
<!-- Print SQL to stdout. -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- Bind the getCurrentSession() method to the thread. -->
<property name="current_session_context_class">thread</property>
<!-- Hibernate XML mapping files -->
<mapping resource="us/tx/state/oag/FinancialCrimesInquiry/db/HbmDdlSearchFieldOperator.hbm.xml"/>
<mapping resource="us/tx/state/oag/FinancialCrimesInquiry/db/HbmDdlSearchField.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Hibernate version: 3.2.x
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-cascade="none" default-access="property" auto-import="true"
package="us.tx.state.oag.FinancialCrimesInquiry.db">
<class name="us.tx.state.oag.FinancialCrimesInquiry.db.HbmDdlSearchField">
<composite-id>
<key-property name="FieldId" column="field_id" type="integer"/>
</composite-id>
<property name="FieldName" column="field_name" type="string" update="false" insert="false"/>
</class>
<sql-query name="ddl_search_fields_spr" callable="true">
<return alias="hbmDdlSearchField" class="HbmDdlSearchField"/>
<![CDATA[
{ call ddl_search_fields_spr() }
]]>
</sql-query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
SessionFactory lo_hbmSF = (SessionFactory)lo_sc.getAttribute(FinancialCrimesInquiryConstants.CS_SF_NAME);
if ( lo_hbmSF == null ) { return; }
lo_hbmSess = lo_hbmSF.getCurrentSession();
Transaction lo_trans = lo_hbmSess.beginTransaction();
List lstSearchFields = lo_hbmSess.getNamedQuery("ddl_search_fields_spr").list();
Full stack trace of any exception that occurs:
2007-03-12 15:34:02,258 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 42S22
2007-03-12 15:34:02,258 ERROR [org.hibernate.util.JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: field1_1_0_
Name and version of the database you are using:
MSSQL, 2000
The generated SQL (show_sql=true):
2007-03-12 15:34:01,961 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-03-12 15:34:01,961 DEBUG [org.hibernate.SQL]
{ call ddl_search_fields_spr() }
2007-03-12 15:34:01,961 INFO [STDOUT] Hibernate:
{ call ddl_search_fields_spr() }
2007-03-12 15:34:02,243 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
|