[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2966) Create table fails for SchemaExport when a column is mapped again with insert="false" update="false"
Varghese C V (JIRA)
noreply at atlassian.com
Thu Nov 22 13:25:56 EST 2007
Create table fails for SchemaExport when a column is mapped again with insert="false" update="false"
----------------------------------------------------------------------------------------------------
Key: HHH-2966
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2966
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate-3.2.5, Hsqldb-1.8.0.7
Reporter: Varghese C V
Attachments: org.hibernate.mapping.Table.patch, repeated-column-mapping-test-case.zip
AbstractCustomer mapping :
<hibernate-mapping>
<class name="org.hibernate.test.schemaexport.AbstractCustomer" abstract="true">
<id name="id" type="java.lang.String">
<column name="ID" length="20" />
<generator class="assigned" />
</id>
<property name="countryCode" type="java.lang.String">
<column name="COUNTRY_CODE" length="2" />
</property>
</class>
</hibernate-mapping>
CorporateCustomer mapping :
<hibernate-mapping>
<union-subclass name="org.hibernate.test.schemaexport.CorporateCustomer" extends="org.hibernate.test.schemaexport.AbstractCustomer">
<many-to-one name="country" class="org.hibernate.test.schemaexport.Country" insert="false" update="false">
<column name="COUNTRY_CODE" length="2" />
</many-to-one>
</union-subclass>
</hibernate-mapping>
For these mappings, the ddl generated by SchemaExport contains the COUNTRY_CODE twice.
Generated Sql
create table CorporateCustomer (
ID varchar(20) not null,
COUNTRY_CODE varchar(2),
COUNTRY_CODE varchar(2),
primary key (ID)
)
I have attached a test case that reproduces this.
I have also attached a patch to org.hibernate.mapping.Table to fix this problem. The patch is simply to skip the duplicate columns when the sql is being generated.
Please do verify.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list