Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascade save not updating relation field #891

Open
14v opened this issue Aug 23, 2019 · 0 comments
Open

Cascade save not updating relation field #891

14v opened this issue Aug 23, 2019 · 0 comments
Labels

Comments

@14v
Copy link

14v commented Aug 23, 2019

  1. Insert entity Nested0 with @get:OneToMany related Nested1 entities list
  2. Change Nested0.Nested1.name to some new value
  3. Update root entity Nested0

Expected: with no cascade action specified in @get:OneToMany using default SAVE or with SAVE specified explicitly Requery persists related entity Nested1 and new name is saved. According to docs When a associative element is added it will be persisted (inserted or updated) if required..

Instead: no matter cascade SAVE specified or not new name not persisted. Modified name field state is modified in entity.

Sample Android App, click Requery Activity button on main screen then click action button.

It is very strange! Field is changed OK in memory, ouputs in UI, but not changed in DB.
There is no update query.

2019-08-23 17:57:43.387 1708-1708 D/RequeryActivity: log: insert: inserting
2019-08-23 17:57:43.405 1708-1708 D/Nested0: toRemote: 0
2019-08-23 17:57:43.461 1708-1708 I/requery: beforeExecuteUpdate sql: create table Nested0 (id integer primary key not null, enumField varchar(255), name varchar(255))
2019-08-23 17:57:43.464 1708-1708 I/requery: afterExecuteUpdate 0
2019-08-23 17:57:43.467 1708-1708 I/requery: beforeExecuteUpdate sql: create table Nested2 (localId integer primary key autoincrement not null, name varchar(255))
2019-08-23 17:57:43.469 1708-1708 I/requery: afterExecuteUpdate 0
2019-08-23 17:57:43.474 1708-1708 I/requery: beforeExecuteUpdate sql: create table Nested1 (localId integer primary key autoincrement not null, name varchar(255), nested0 integer, nested2 integer, foreign key (nested0) references Nested0 (id) on delete cascade on update cascade, foreign key (nested2) references Nested2 (localId) on delete cascade)
2019-08-23 17:57:43.477 1708-1708 I/requery: afterExecuteUpdate 0
2019-08-23 17:57:43.484 1708-1716 I/zygote: Do partial code cache collection, code=33KB, data=52KB
2019-08-23 17:57:43.484 1708-1716 I/zygote: After code cache collection, code=33KB, data=52KB
2019-08-23 17:57:43.484 1708-1716 I/zygote: Increasing code cache capacity to 256KB
2019-08-23 17:57:43.486 1708-1716 I/zygote: Compiler allocated 5MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
2019-08-23 17:57:43.502 1708-1708 I/requery: beforeExecuteUpdate sql: insert into Nested0 (id, enumField, name) values (?, ?, ?)
2019-08-23 17:57:43.504 1708-1708 I/requery: afterExecuteUpdate 1
2019-08-23 17:57:43.511 1708-1708 I/requery: beforeExecuteUpdate sql: insert into Nested2 (name) values (?)
2019-08-23 17:57:43.516 1708-1708 I/requery: afterExecuteUpdate 1
2019-08-23 17:57:43.521 1708-1708 I/requery: beforeExecuteUpdate sql: insert into Nested1 (name, nested0, nested2) values (?, ?, ?)
2019-08-23 17:57:43.523 1708-1708 I/requery: afterExecuteUpdate 1
2019-08-23 17:57:43.530 1708-1708 I/requery: beforeExecuteQuery sql: select localId, name, nested0, nested2 from Nested1 where nested0 = ? 
2019-08-23 17:57:43.534 1708-1708 I/requery: afterExecuteQuery
2019-08-23 17:57:43.546 1708-1708 D/RequeryActivity: log: inserted n1 name: name 0.07241154416416806
2019-08-23 17:57:43.550 1708-1708 D/RequeryActivity: log: setting nested1 new name
2019-08-23 17:57:43.550 1708-1708 D/RequeryActivity: onCreate: updating with new name
2019-08-23 17:57:43.551 1708-1708 D/RequeryActivity: onCreate: subscribed to update
2019-08-23 17:57:43.557 1708-1708 D/RequeryActivity: log: select:
2019-08-23 17:57:43.566 1708-1708 I/requery: beforeExecuteQuery sql: select id, enumField, name from Nested0 where id = ? 
2019-08-23 17:57:43.569 1708-1708 I/requery: afterExecuteQuery
2019-08-23 17:57:43.574 1708-1708 D/RequeryActivity: log: n0 name: name 0.7862791794794157; n1 name: Edit 666

изображение

@npurushe npurushe assigned npurushe and unassigned npurushe Sep 9, 2019
@npurushe npurushe added the bug label Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants