Hi all,
In one table I need to have self-referencing relationship (foreign keys). I use MySQL with modified adaptor, so that it uses InnoDB engine and creates foreign keys on Schema.create. I define FK field as Option-al, so that it's nullable, therefore my referential integrity is all right even if I don't specify a FK (a necessary thing in self referencing FKs). In schema I define following:
val siteToSites = oneToManyRelation(sites, sites).via( ( parent, site ) => parent.id === site.parent )
Everything was fine, until I upgraded to Squeryl 0.9.4-RC6. After the upgrade, I get the exception on Schema.create:
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:77) ~[scala-library-2.8.1.jar:na]
at org.squeryl.dsl.QueryDsl$
class.org$squeryl$dsl$QueryDsl$
$_splitEquality(QueryDsl.scala:604) ~[squeryl_2.8.1-0.9.4-RC6.jar:na]
at org.squeryl.dsl.QueryDsl
$OneToManyRelationImpl.<init>(QueryDsl.scala:546)
~[squeryl_2.8.1-0.9.4-RC6.jar:na]
at org.squeryl.dsl.QueryDsl
$OneToManyRelationBuilder.via(QueryDsl.scala:521)
~[squeryl_2.8.1-0.9.4-RC6.jar:na]
...
what is wrong? Squeryl suddenly doesn't support self-referencing FKs? If I roll back to 0.9.4-RC3, it works perfectly. In RC6 I must remove self-referencing relationship from my schema, otherwise I'm not able to start my application.
Please, help.
Thanks
Jan