I`ve been working with NHibernate for almost an year now. Everything works fine when I send objects from Flex to .Net and try to store them. If it`s a new object(represented by an Id 0) it creates the entry, and if it`s an update, it detects which object I want to edit, update all properties and store it correctly.
Now I`m engaged on a project where I need to use DB4O. I Tried to use the same structure I used ith NHibernate, but considering I don`t have a relational database and so I don`t have explicit identity IDs, all I have is DB4O internal Ids and UUIDs.
The problem appears when I`m trying to update an object on a simple Flex CRUD screen. I send it to backend(c#), Fluorine`s working fine because all the conversion goes ok and I have the object I want. I tried some hints I found on other forums but none worked. Tried to get the object instance on DB4O cache, the object`s internal Id, the UUID, etc., but I never managed to pass an object received from Flex as parameter to the IObjectContainer.Ext().GetID(obj) method and have the stored object instance.
If I create a object in .Net, store it, retrieve it using it`s Id or a QueryByExample I manage to get the stored object, but if it comes already edited from flex, I can`t get a valid instance of the stored object. It looks like DB4O loses his internal Ids when objects move from .Net to Flex and the way back.
I tried using a UUID in Flex and a GUID in .net but it didn`t work.
Being direct, the object I received from .Net and I`m using on Flex, for some dark and magic reason, is not considered the same when it gets back to .Net
The only way I found to retrieve the stored object was assigning an Id for it on frontend and querying by Id on backend. With the stored object instance I can do all the updates, but if the object already came updated from frontend, should I need to update all properties manually before storing it again? I know it`s not a usable solution, so I need a great idea to get that item on my flex datagrid and show DB4O that it`s just an edited object it already had there. I need a way not to lose the object`s internal Id when sent to Flex.
Sorry if I coudn`t be clearer, but this is driving me nuts for 2 days. I guessed it shouldn`t be that hard considering I already worked with ORMs.
Thanks in advance.