In general NH don't generate any kind of constraint because the NH-cascade do the right thing (much more complex than a "simple" trigger).BTW to have better performance on in case of cascade="delete" we had a new feature in NH2.0: The tag on-delete="cascade" . That tag create an ON DELETE CASCADE. It if very important to remember that tag <cascade> and the tag <on-delete> are two very different things (see reference). Bye. Fabio Maulo.
2008/9/21 JadziaPM <[EMAIL PROTECTED]> > > 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. > > 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. > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
