Support #542
recursive relationships in Dbo?
0%
Description
Hi all,
I'm just starting to use Wt::Dbo, seeing if it will work in a project I'm involved in. I suspect I'm running up against a Dbo limitation, and I'd appreciate confirmation.
I have a class A which is recursive, through a class B; i.e. A has-an-optional B (implemented with hasMany because there's no one-to-one mapping type), and B has-many A. Effectively then, A can have zero or more A.
I create a transient A with no B children, then try to session~~add() it. When I flush() the resulting Dbo::ptr~~ I'm flushing because I want to log the id() - I get "A collection for 'A:0' is already in use. Reentrant [etc.]".
I'm not explicitly using a collection in a reentrant way, but is the recursive relationship causing Dbo to do so under the hood?
If so, is there some other way to accomplish the same thing? I know I can map the foreign key relationships as integers and manage them manually, but that's a bletcherous hack I'd rather avoid.
Thanks,
Sean
Updated by Koen Deforche over 12 years ago
Hey Sean,
Let me try to reproduce this in the test suite. This shouldn't be a limitation in Dbo --- recursive relations without the indirect class are used e.g. in the comments of the blog.
Regards,
koen
Updated by Koen Deforche over 12 years ago
- Status changed from New to Feedback
Hey Sean,
I'ld appreciate it alot if you can make a small test case, and I'll work from that ?
Regards
koen
Updated by Sean Hogan over 12 years ago
So far I haven't been able to make it happen in a test case. :(
I had disabled that relationship in the larger app so that I could continue; I'll reenable it and see if the problem still exists.
Regards,
Sean
Updated by Sean Hogan over 12 years ago
... and of course now the larger app doesn't show the problem either!
Let's chalk this up to a "Code 18"... the problem was 18 inches in front of the monitor. ;-)
Thanks for your support and a great s/w package,
Sean
Updated by Koen Deforche over 12 years ago
- Status changed from Feedback to Resolved
Bugs which automatically resolve are at the same time the best and the worst :-)