-->
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: Polymorphic many-to-one generates bad constraints for HSQLDB
PostPosted: Tue Sep 13, 2005 5:32 pm 
Beginner
Beginner

Joined: Fri Sep 05, 2003 6:11 pm
Posts: 34
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

Mapping documents:

<hibernate-mapping package="kls.domain.entity.solo">
<class name="SoloNote" table="s_notes" discriminator-value="">
<id name="id" column="solon_nu">
<generator class="identity"/>
</id>
<discriminator column="solon_source"/>

<property name="code" column="solon_type"/>
<property name="note" column="solon_text"/>

<property name="creationDate" column="solon_date"/>

<subclass name="SoloHawbNote" discriminator-value="HAWB">
<property name="username" access="field" column="solon_createdby"/>
<many-to-one name="hawb" class="SoloHawb" column="solon_sourcenu"/>
</subclass>

<subclass name="SoloMawbNote" discriminator-value="MAWB">
<property name="username" access="field" column="solon_createdby"/>
<many-to-one name="mawb" class="SoloMawb" column="solon_sourcenu"/>
</subclass>

</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
HSQLDB 1.8.0.2

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:



When using SchemaExport to generate DDL
I end up with two constraints:

alter table s_notes add constraint FK6BCB4FF5CAE77A82 foreign key (solon_sourcenu) references s_mawb
alter table s_notes add constraint FK6BCB4FF5CAE534A7 foreign key (solon_sourcenu) references s_hawb


These make it impossible to insert notes


What am I doing wrong?


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.