-
Notifications
You must be signed in to change notification settings - Fork 120
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
Immutable entities via copyWithId setter #393
base: main
Are you sure you want to change the base?
Conversation
Thanks, we'll have a look! |
From a quick look this breaks the contract that put modifies the same object as mentioned in the original issue. |
Yes, put and putMany (and etc) change ID for objects before (or after) send it to storage. In the case of immutability (in this PR) it is imposible to change immutable objects, and it sends to storage new objects, constructed by copyWith. But it is obvious for the client code that an immutable entity should not change. And if such code uses immutability, it should not rely on side effects. In other cases, everything works as before. Maybe it might make sense to define new methods for immutable entities (putImmutable, putManyImmutable, etc)... It is not problem. |
Again thanks for this! I guess you already figured out that relations are going to be a problem as well. We'll have a look at this in more detail and if it makes sense to integrate. |
Yes. My bad: I don't think about relations at the start.. It is really lot of work to make relations in immutable case!
Thank you |
Ping? |
@rafuck Haven't looked at this, yet. |
up |
any update in the case of immutable classes and autoincrementing id? |
Immutable entities support (see Issue-307)