NHibernate collections and moving objects -
I have settled in a big problem for me with NHibernate. I have 2 objects, each item is a collection of object A Need to move one object into the collection of object B. I get an error about the deleted object because I believe NHibernate tries to remove the object from object A when it needs to be kept Is object b In terms of new DB, it's a matter of updating the "parent" new object properties (object B). But with the collection, I really do not know what to do ...
Is there a good process to move the object from object to NHibernate?
Thanks in advance for any help.
Regards,
Eric.
I'm assuming that you have a class of objects representing A and B, that is, A and B For example, using Cascade in the mapping, there are two examples of some class X, and the mapping of X is a cascade attribute on the collection in which
if you are able to move the object from one compilation to another If you want to be, you have to consider whether the things , Whether being must be an entity that is independent of the two collections.
If the transfer object is not saved automatically, then when you make the transfer, you will participate in problems because the transfer object is already known in the session.
In two ways, I can think of treating the better transfers of both objects as an independent object which does not rely on cascading in the mapping of objects with DB (i.e., the collection) But the self is saved. Conceptually, it makes sense because if you can move it from one collection to another, which means that it is independent of two objects that are collected in any way. This means that you can end up with orphans.
If you want to use cascade in mapping, you will need to remove Object A from object A. I suspect that it is not what you want to do.
Comments
Post a Comment