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.