I'm porting from Hibernate 2.0.2 to 2.1.2 and running into the same (or similar) issue with a mapping file that worked fine in the older version. Oracle 9i. My mapping looks like this:
Code:
<class name="AccountBO" table="ACCOUNT">
<!-- Fails whether or not the id is mapped to a property -->
<id column="ACCOUNT_ID" type="long">
<generator class="sequence">
<param name="sequence">seq_account_id</param>
</generator>
</id>
<component name="account" class="Account">
<!- - NOTE double mapping of this columns. - ->
<property name="accountID" column="ACCOUNT_ID"/>
<!-- ... -->
</component>
<!-- ... -->
</class>
Yes I know its an ugly model but its a mapping to a legacy database I can't change.
On HBN 2.0.2 I had insert="false" update="false" on the component, but 2.1.2 complains about that so I had to remove it.
The generated SQL has a double use of ACCOUNT_ID:
Code:
select accountbo0_.ACCOUNT_ID as ACCOUNT_ID, accountbo0_.ACCOUNT_ID as ACCOUNT_ID,
accountbo0_.BILLER_COMPANY_ID as BILLER_C2_,
accountbo0_.PAYER_COMPANY_ID as PAYER_CO3_,
accountbo0_.VENDOR_ID as VENDOR_ID
from ACCOUNT accountbo0_ where (accountbo0_.BILLER_COMPANY_ID is not null )and(accountbo0_.PAYER_COMPANY_ID is not null )and(accountbo0_.VENDOR_ID is not null )
Again, this mapping worked just fine in 2.0 but is now broken in 2.1. Anybody have workaround?