AssertionError exception with self-referencing foreign keys

조회수 69회
읽지 않은 첫 메시지로 건너뛰기

Ján Raška

읽지 않음,
2011. 3. 22. 오전 6:54:5411. 3. 22.
받는사람 squ...@googlegroups.com
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

David Whittaker

읽지 않음,
2011. 3. 22. 오전 9:05:4811. 3. 22.
받는사람 squ...@googlegroups.com, Ján Raška
Ján,

I believe this is a bug that's been fixed in master.  Do you know how to build a new version to see if that fixes your problem?

Ján Raška

읽지 않음,
2011. 3. 22. 오후 4:43:4611. 3. 22.
받는사람 squ...@googlegroups.com, Ján Raška, David Whittaker
Unfortunatelly I don't. I just use what's available through maven. But if there is a snapshot repository that contains nightly builds, I'll give it a try, I just don't know repo url (it's not on scala-tools.org, I checked).

Or if you can give me some hit, I might try to build it.

Maxime Lévesque

읽지 않음,
2011. 3. 23. 오전 7:28:5511. 3. 23.
받는사람 squ...@googlegroups.com

I encourage you to try building squeryl ... SBT makes it so easy 


I pushed this snapshot, if you're not successful with building.... (but please try ;) )  :

  http://nexus.scala-tools.org/content/repositories/releases/org/squeryl/squeryl_2.8.1/0.9.4-RC6_2011-03-23/squeryl_2.8.1-0.9.4-RC6_2011-03-23.jar


2011/3/22 Ján Raška <ras...@gmail.com>

Ján Raška

읽지 않음,
2011. 3. 28. 오후 4:09:1011. 3. 28.
받는사람 squ...@googlegroups.com, Maxime Lévesque
Thanks Max,

I tried it with snapshot and it works. I'll try to build squeryl too sometimes in the future, but I don't have a time for it right now, as I'd firstly need to get familiar with SBT (I still use maven).

But thanks a lot, I'll use this snapshot build until there is RC7 or final version published.

Jan
전체답장
작성자에게 답글
전달
새 메시지 0개