looks like: 1. create 2 objects with ManyToMany relationship (like User with collection of #groups and Group with collection of #users). user:= User new. group := Group new.. 2. register one of them session inUnitOfWorkDo:[session register: group]. 3. create relationship user groups add: group. group users add: user. 4. register another one session inUnitOfWorkDo:[session register: user]. 5. aDatabaseRow hasOldVersion = true 6. glorp tries to update instead of insert 7. PROFIT
-- You received this message because you are subscribed to the Google Groups "glorp-group" group. To view this discussion on the web visit https://groups.google.com/d/msg/glorp-group/-/Nm9zu5DWkhIJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
Of cours, we can do:
session inUnitOfWorkDo:[session register: user; register: group. user groups add: group. group users add: user] and it will be OK, but bug is so ugly =( On Tuesday, June 19, 2012 3:20:44 PM UTC+4, Micael Alastor wrote:
You received this message because you are subscribed to the Google Groups "glorp-group" group. To view this discussion on the web visit https://groups.google.com/d/msg/glorp-group/-/1igt4L-awgMJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
I think this is probably
related to primary keys, or lack of same, on the link table. I think
it's that you should have both link table fields as a primary key,
though I don't have an example handy to check.
Micael Alastor wrote: Of cours, we can do:-- You received this message because you are subscribed to the Google Groups "glorp-group" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
tableForAOSUSERS_AOSSECURITYGROUPS: aTable | user group | user := aTable createFieldNamed: 'USERID' type: (platform varchar: 36). user bePrimaryKey. aTable addForeignKeyFrom: user to: ((self tableNamed: 'AOSUSERS') fieldNamed: 'ID'). group := aTable createFieldNamed: 'GROUPID' type: (platform varchar: 36). group bePrimaryKey. aTable addForeignKeyFrom: group to: ((self tableNamed: 'AOSUSERS') fieldNamed: 'ID') It's the description of the link table. There is an easy workaround, so.. On Tuesday, June 19, 2012 7:26:15 PM UTC+4, alan.knight wrote: -- You received this message because you are subscribed to the Google Groups "glorp-group" group. To view this discussion on the web visit https://groups.google.com/d/msg/glorp-group/-/pjWySSXj2nwJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
Hmm. Very peculiar, though. There's no way it should make any difference what order you add things to the unit of work.
On Tue, Jun 19, 2012 at 8:47 AM, Micael Alastor <[hidden email]> wrote:
-- You received this message because you are subscribed to the Google Groups "glorp-group" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
In reply to this post by Micael Alastor
I wonder if it would help if your primary keys were integers
instead? Your existing design should work okay, but it would be useful to know
if that change has an effect. From: [hidden email]
[mailto:[hidden email]] On Behalf Of Micael Alastor tableForAOSUSERS_AOSSECURITYGROUPS: aTable | user group | user := aTable
createFieldNamed: 'USERID' type: (platform varchar: 36). user
bePrimaryKey. aTable
addForeignKeyFrom: user to:
((self tableNamed: 'AOSUSERS') fieldNamed: 'ID'). group :=
aTable createFieldNamed: 'GROUPID' type: (platform varchar: 36). group
bePrimaryKey. aTable
addForeignKeyFrom: group to:
((self tableNamed: 'AOSUSERS') fieldNamed: 'ID') It's the description of the link table. There is an easy
workaround, so..
I think this is probably related to primary keys, or lack of
same, on the link table. I think it's that you should have both link table
fields as a primary key, though I don't have an example handy to check. Of cours, we can do: session inUnitOfWorkDo:[session register: user; register:
group. user groups add: group. group users add: user] and it will be OK, but bug is so ugly =(
looks like: 1. create 2 objects with ManyToMany relationship (like User
with collection of #groups and Group with collection of #users). user:= User new. group := Group new.. 2. register one of them session inUnitOfWorkDo:[session register: group]. 3. create relationship user groups add: group. group users add: user. 4. register another one session inUnitOfWorkDo:[session register: user]. 5. aDatabaseRow hasOldVersion = true 6. glorp tries to update instead of insert 7. PROFIT -- -- You received this message because you are subscribed to the Google Groups "glorp-group" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en. |
Free forum by Nabble | Edit this page |