Using Aurelius on Android when server offline

I'm planning to use Aurelius in an Android app, connected to a server (using XData and the internet). But what do I do when the phone can't connect to the Server?
All classes have primary Keys in the form of IDs. When classes are not saved to the server, the IDs are 0. So only the classes that have - at least once - been saved to the server have an ID >0. I thought about saving the classes to a local SQLite database as well, to keep them safe, but then the IDs are filled with values from that local SQLite database.
Can I somehow keep the IDs in sync with the server when the connection to the server is back up? Or is there abetter way to save the Aurelius Objects locally, not changing the IDs?

That is data replication and it's not a simple matter at all. Actually we're working exactly on a product solution for that, which will allow saving data in a local database and synchronizing it with a remote one.

Until it's done, you will have to manage it yourself.  The suggestion is using GUID id's so you are safe that the id is unique and can be easily copied to the remote database without conflicting with other id's.

I don't mind waiting for a good solution. Do you have any idea how long it will take before you have a product for that available? And I won't hold it against you if you don't manage te complete it in time :-)

We're working on it right now. No exact estimate yet, but I guess it could be available in a couple of months.

This is very interesting. I need to implement some kind of offline features to my application also.


Some cases (not only offline, mainly because of performance reasons) I need to retrieve object from ObjectManager without accessing/trying underlying database.  I made adapter class TSafirObjectManagerAdapter = class (TObjectManager) to accelerate (many-to-many relation) searches. 

function TSafirObjectManagerAdapter.FindPersistent(Clazz: TClass; IdValue: Variant): TObject;
begin
   Result := self.GetFObjects.GetById(Clazz, IdValue);
end;

function TSafirObjectManagerAdapter.FindPersistent<E>(IdValue: Variant): E;
begin
   Result := E(FindPersistent(TClass(E), IdValue));
end;

This feature could be directly supported in Aurelius Object Manager.
I'm not sure if I understood your code purpose. If you are just trying to retrieve the object from the in-memory cache of object manager, it already does that when you call Find. It seems you don't need to create yet another FindPersistent?

Find does same but if object is not found then it creates criteria to access database. I'm preloading all many-to-many objects to object manager and I want to find only those persistent objects. In high latency networks it is very slow to access database separately for every relationship object. My FindPersistent retrieves cached objects only.