Hello,
I have a newbie question about Hibernate, as I don't know your tool still. I used to work on JDO implementations and they perform very well but I ran into problems when trying to use JDO in J2EE apps. That's why I am looking at Hibernate and want to get some basic info.
Well, can you comment on my use case?
I have an application that has one central database and remote clients - some of them have embeded databases with subset of central db's data, some don't have any db and work online.
Now, I want to perform very basic operation. Take an object list from server, edit them (CRUD) - add, delete, update some of them. Then send them back to server and server should perform all operations to persist the changes.
Seems simple? Well, to the hell, I cannot make it working for a long time.
Now. The objects I edit have some other objects connected, taken from db (for example properties that are in dictionaries and so on). So I want to load the graph of objects - or subset of this graph (only fields that needed to be shown in client app) and transfer to the client app. On client app, the user changes some of the objects. Then I want to send all graph back. For simplicity, lets assume I don't delete any objects in this use case.
Now - does Hibernate automate such an operation? In JDO it looks very simple (looks but doesn't work hehe). I just take the interesting objects by simple query. I detach them from db (and all associated dictionary fields are detached automaticly) and just return object graph from EJB. On the client side, I edit data as normal plain java objects. Then I take the object collection and send back to EJB. In EJB I can persist the changes. But here come problems - there are problems with recognition which objects are new and have to be stored in db, which are edited and need to be updated and so on.
How such a case would be done in Hibernate? How Hibernate recognizes which objects from the graph it has to write to db and which of them not? Is there any simple example of such funcionality to see?
And one question more - does Hibernate work without managed environment (application server)?
|