-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Subclasses referencing the same list causes problems
PostPosted: Thu May 07, 2009 3:51 pm 
Newbie

Joined: Thu May 07, 2009 3:32 pm
Posts: 1
I have the following schema in my hbm.xml file
<hibernate-mapping>
<class name="com.beans.MyTemplate" table="MyTemplate">
<composite-id name="key" class="com.beans.MyTemplatePk">
<key-property name="dataStoreId"/>
<key-property name="name"/>
</composite-id>
<discriminator column="advanced" type="string"/>
<property name="reportType"/>

<subclass name="com.beans.SatReport" discriminator-value="A">
<property name="includeTableForAllGraphs"/>

<list name="fileSizeBucketList" cascade="save-update" lazy="false">
<key not-null="true">
<column name="dataStoreId" />
<column name="name"/>
</key>
<list-index column="sortOrder"/>
<many-to-many class="com.beans.TierBucket" column="key"/>
</list>

<list name="satReportSelections" cascade="all-delete-orphan" lazy="false">
<key not-null="true">
<column name="dataStoreId" not-null="true"/>
<column name="name" not-null="true"/>
</key>
<list-index column="sortOrder"/>
<composite-element class="com.beans.SatReportSelection">
<property name="key"/>
<property name="selected"/>
</composite-element>
</list>
</subclass>
<subclass name="com.beans.SatBatReport" discriminator-value="C">
<property name="npv"/>
<property name="chartStyle" type="string" not-null="true">
<column name="chartStyle" default="'Color Fill'"/>
</property>
<list name="fileAgeBucketList" cascade="save-update" lazy="false">
<key not-null="true">
<column name="dataStoreId" />
<column name="name"/>
</key>
<list-index column="sortOrder"/>
<many-to-many class="com.beans.TierBucket" column="key"/>
</list>
<list name="satReportSelections" cascade="all-delete-orphan" lazy="false">
<key not-null="true">
<column name="dataStoreId" not-null="true"/>
<column name="name" not-null="true"/>
</key>
<list-index column="sortOrder"/>
<composite-element class="com.beans.SatReportSelection">
<property name="key"/>
<property name="selected"/>
</composite-element>
</list>
</subclass>
</class>
</hibernate-mapping>

The two subclasses SatReport and SatBatReport have the same lists fileSizeBucketList and satReportSelections. I see the following error messages in the log file.

2009-05-07 13:52:37,157 ERROR hbm2ddl.SchemaUpdate: Unsuccessful: alter table fileAgeBucketList add constraint FKCCF1CFEB36E6E9B2 foreign key (dataStoreId, name) references MyTemplate
2009-05-07 13:52:37,157 ERROR hbm2ddl.SchemaUpdate: Constraint already exists in statement [alter table fileAgeBucketList add constraint FKCCF1CFEB36E6E9B2 foreign key (dataStoreId, name) references MyTemplate]
2009-05-07 13:52:37,157 ERROR hbm2ddl.SchemaUpdate: Unsuccessful: alter table satReportSelections add constraint FK54CF74C136E6E9B2 foreign key (dataStoreId, name) references MyTemplate
2009-05-07 13:52:37,157 ERROR hbm2ddl.SchemaUpdate: Constraint already exists in statement [alter table satReportSelections add constraint FK54CF74C136E6E9B2 foreign key (dataStoreId, name) references MyTemplate]

Any idea how to avoid these error messages? Saving and retrieving objects seem to work fine.

Thanks,
Bindu


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.