Hi,
I have used hibernate and a few other simple ORM's. They're nice....., and make it easier to develop, rather than have to put SQL everywhere.
However, They do add an overhead to retrieving stuff from the database.
I would like an ORM that does the following.
1) has a way of getting/setting
java business objects, and maybe has its own query language....in essence, this would be the ORM side..... these objects will be attempted to be retrieved from memory, in a
thread safe manor, and provide locking so only one instance of a business entity shall be available at any one point..... no attempt by the ORM to access the database itself shall be made.
2) if the business object can't be accessed from memory, the framework should call my own helper methods to realize that object.... at which point my own code will query the database, and build the object. This should all be done in a threadsafe manor, so, for example, two concurrent requests to this ORM framework for an object, would result in a single method call to my code to construct it.
3) Updates to these objects will *not* be reflected in the database... not straight away, anyhow.... To be honest, I'm willing to sacrifice the 'D' in database ACID, if it means I can have 100x the speed.... So, if I say customer.setStockQty(100) - then this will set an instance variable to 100, and thats about it.
If memory is getting low, then the ORM will flush objects out of memory, and will call my own helper methods to ensure they are correctly persisted. Again, this should all be threadsafe, so that a request for an object currently been flushed, doesn't end up with an object that is well out of date. If the server is shutdown. then all objects would obviously need to be flushed to the database, but I'm happy that if the server terminates unexpectedly then there might be data loss.
Im sure this is possible to do..... I have started to write my own, but its not easy, at all, to get everything threadsafe, without having too much synchronisation..... And, I'd rather use one that already exists, and concentrate on my actual facebook game, rather than yet another homebrew framework.
Does anyone know of such a framework?
Cheers,
Tony.