-->
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: Constraint does not generate "on delete cascade"
PostPosted: Sun Sep 21, 2008 2:33 pm 
Newbie

Joined: Sun Sep 21, 2008 2:29 pm
Posts: 1
Hello,
I am currently having an issue when using NHibernate 2.0.0 and
MySQL5Dialect
Basically I wish my foreign-key constaints to have ON DELETE CASCADE
ON UPDATE CASCADE
However when I generate my Database schema these constraints are
missing.

Foreign-key constraint to have the "on delete cascade" option in the generate DDL

I have 3 tables [1] Fixture and the other [2] Team [3] FIxtureTeam

----------------------FIxture----------------------------------
<id name="Fixtureid" column="fixtureid" type="long">
<generator class="native" />
</id>
<bag name="TeamsThatPlayedInThisFixture" inverse="true"
table="fixtureteam" lazy="true" cascade="all" >
<key column="fixtureid" />
<one-to-many class="FixtureTeam" />
</bag>
--------------------------------------------------------

----------------------Team----------------------------------
<id name="Teamid" column="teamid" type="long">
<generator class="native" />
</id>
<property type="string" not-null="true" length="50"
name="Teamname" column="teamname" unique="true"/>
<bag name="FixtureHistory" inverse="true" table="fixtureteam"
lazy="true" cascade="all">
<key column="teamid"/>
<one-to-many class="FixtureTeam" />
</bag>
--------------------------------------------------------

So Fixture has a one to many relationship with FixtureTeam
That is, there are two teams per fixture

----------------------FIxtureTeam----------------------------------
<!-- A composite primary key, made up from the primary keys
(fixtureid, teamid) from fixture and team tables -->
<composite-id name="FixtureTeamid" class="FixtureTeamCompoundKey">
<key-property type="long" name="Fixtureid" column="fixtureid"/>
<key-property type="long" name="Teamid" column="teamid" />
</composite-id>
--------------------------------------------------------

I seem to be having the same issue as the Java version MySQL5Dialect
Issue here.
-----------------------------------------------------------------
http://forum.hibernate.org/viewtopic.php?t=986157
--------------------------------------------------------------

Any suggestions would be great.


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.