The reason I am asking, is because line 37 of the class "org.hibernate.loader.DefaultEntityAliases" returns the correct user established result set aliases when using a standard "id" property.
Ufortunately, when using a "composite-id" line 37 always returns null, which results in hibernate trying to alias the column names. I'm not sure if this is a bug, or my improper usage (probably the later).
Here is my mapping file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="pricemanagement.PriceManagementProposalStatistics" mutable="false">
<composite-id>
<key-property name="items"/>
<key-property name="itemPercent"/>
<key-property name="sales"/>
</composite-id>
<property name="salesPercent"/>
<property name="incrementalGrossProfit"/>
<property name="expectedGrossProfitPercent"/>
<property name="grossProfitPercentDelta"/>
<property name="type"/>
</class>
<sql-query name="GetPMProposalStatistics" callable="true">
<return alias="proposalStatistics" class="pricemanagement.PriceManagementProposalStatistics">
<return-property name="items" column="items"/>
<return-property name="itemPercent" column="itemPercent"/>
<return-property name="sales" column="sales"/>
<return-property name="salesPercent" column="salesPercent"/>
<return-property name="incrementalGrossProfit" column="incrementalGP"/>
<return-property name="expectedGrossProfitPercent" column="expectedGPPercent"/>
<return-property name="grossProfitPercentDelta" column="grossProfitPercentChange"/>
<return-property name="type" column="statType"/>
</return>
{call GetRBPProposalStatistics(:projectKey, :userKey, :accountManagerKey) }
</sql-query>
</hibernate-mapping>
And the error:
Code:
Hibernate: {call GetRBPProposalStatistics(?, ?, ?) }
[WARN] JDBCExceptionReporter - SQL Error: 0, SQLState: 42S22
[ERROR] JDBCExceptionReporter - [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: items0_
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: items0_
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: items0_
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getColumnOrdinal(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getInt(Unknown Source)
at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:236)
at org.hibernate.type.IntegerType.get(IntegerType.java:26)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
at org.hibernate.type.ComponentType.hydrate(ComponentType.java:423)
at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:182)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:759)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:292)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
Thanks for any help...