Hi,
We are using the presentation server in our application. We use Hibernate 3 as our persistence framework. We convert our object model to XML and vice-versa, for which we have a custom implementation of XML <-> Object transformer. However, we are facing challenges when it comes to XML -> Object. Here are some of the things that need to be taken care of, in our scheme of things: 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. 2. Also, in our case, all the changes are written to the persistent version of the object graph. So the XML fragment of every entity needs to have the persistence id, and this needs to be used to obtain the appropriate persistent object and the changes be written to this object. Are there other users out there who use hibernate for persistence and the presentation server for view ? If so, I'd like to learn from your experiences. Thanks, Radhakrishnan -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Radhakrishnan,
I have done exactly what you are outlining: - I use Orbeon Forms for my presentation layer - I use a combination of custom java code and JiBX to map between XML and my domain model (and vice versa) - All my business and process logic exists in Java - I use Hibernate for persistence I chose not to use the Hibernate-XML mapping tool, as it does not seem to be stable enough (from glancing at the Hibernate documentation). > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. Well, there are 2 ways (as I can see it) to implement a delete: 1. Every time an entity has been deleted in the interface, send the commands delete(entity, ID), GetAll(entity) to refresh the interface 2. When a user saves his changes, the interface XML list (where one or more elements have been deleted) is synchronised with the persistent list (e.g. hibernate merge) My preference is 1), as it really simplifies any concurrency issues. Your particular application may of course dictate this. Hope that helps. Henrik On 11/29/06, [hidden email] <[hidden email]> wrote: > Hi, > > We are using the presentation server in our application. We use Hibernate 3 as our persistence framework. We convert our object model to XML and vice-versa, for which we have a custom implementation of XML <-> Object transformer. However, we are facing challenges when it comes to XML -> Object. Here are some of the things that need to be taken care of, in our scheme of things: > > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. > > 2. Also, in our case, all the changes are written to the persistent version of the object graph. So the XML fragment of every entity needs to have the persistence id, and this needs to be used to obtain the appropriate persistent object and the changes be written to this object. > > Are there other users out there who use hibernate for persistence and the presentation server for view ? If so, I'd like to learn from your experiences. > > Thanks, > Radhakrishnan > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Radhakrishnan J
Henrik,
Thanks for the response. Please find my thoughts
inlined.
Thanks again,
Radhakrishnan From: Henrik Pettersen [mailto:[hidden email]] Sent: Wednesday, November 29, 2006 5:16 PM To: [hidden email] Subject: Re: [ops-users] XML -> Object conversion when using Hibernate I have done exactly what you are outlining: - I use Orbeon Forms for my presentation layer - I use a combination of custom java code and JiBX to map between XML and my domain model (and vice versa) - All my business and process logic exists in Java - I use Hibernate for persistence I chose not to use the Hibernate-XML mapping tool, as it does not seem to be stable enough (from glancing at the Hibernate documentation). > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. Well, there are 2 ways (as I can see it) to implement a delete: 1. Every time an entity has been deleted in the interface, send the commands delete(entity, ID), GetAll(entity) to refresh the interface [Radhakrishnan J.] Our UI has a 'save' button and for this reason this approach does not conform to our UI design. But ofcourse buffering up user operations on the screen and the consequent save increases the potential for concurrency conflicts. But that is still OK with us. Our entities would be versioned and optimistic concurrency would be enabled. 2. When a user saves his changes, the interface XML list (where one or more elements have been deleted) is synchronised with the persistent list (e.g. hibernate merge) [Radhakrishnan J.] Hmm, this is how we'd like to have it. And we'd would like to refrain from using merge. Like I mentioned, we'd like to synchronize the XML into the attached entity directly. My preference is 1), as it really simplifies any concurrency issues. Your particular application may of course dictate this. Hope that helps. Henrik On 11/29/06, [hidden email] <[hidden email]> wrote: > Hi, > > We are using the presentation server in our application. We use Hibernate 3 as our persistence framework. We convert our object model to XML and vice-versa, for which we have a custom implementation of XML <-> Object transformer. However, we are facing challenges when it comes to XML -> Object. Here are some of the things that need to be taken care of, in our scheme of things: > > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. > > 2. Also, in our case, all the changes are written to the persistent version of the object graph. So the XML fragment of every entity needs to have the persistence id, and this needs to be used to obtain the appropriate persistent object and the changes be written to this object. > > Are there other users out there who use hibernate for persistence and the presentation server for view ? If so, I'd like to learn from your experiences. > > Thanks, > Radhakrishnan > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Radhakrishnan,
The main problem with mapping from Hibernate to XML, is that you get entities in a detached state: http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-overview In "Persistent" mode, removing an item from a (persistent) list is all you need to do to update your persistence store. No such luck when doing the same in (detached) XML. Here is how you are supposed to deal with detached objects in Hibernate: http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-detached Unfortunately, I am not familiar with the Hibernate XML mapping, so I cannot comment on this. It might have a better solution. This is the XML mapping framework I am using: http://jibx.sourceforge.net/ Hope this helps. Henrik On 11/29/06, Radhakrishnan J. <[hidden email]> wrote: > > > Henrik, > > Thanks for the response. Please find my thoughts inlined. > > Thanks again, > Radhakrishnan > > ________________________________ > Sent: Wednesday, November 29, 2006 5:16 PM > To: [hidden email] > Subject: Re: [ops-users] XML -> Object conversion when using Hibernate > > > Radhakrishnan, > > I have done exactly what you are outlining: > - I use Orbeon Forms for my presentation layer > - I use a combination of custom java code and JiBX to map between XML and my domain model (and vice versa) > - All my business and process logic exists in Java > - I use Hibernate for persistence > > I chose not to use the Hibernate-XML mapping tool, as it does not seem to be stable enough (from glancing at the Hibernate documentation). > > > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. > > Well, there are 2 ways (as I can see it) to implement a delete: > 1. Every time an entity has been deleted in the interface, send the commands delete(entity, ID), GetAll(entity) to refresh the interface > [Radhakrishnan J.] Our UI has a 'save' button and for this reason this approach does not conform to our UI design. But ofcourse buffering up user operations on the screen and the consequent save increases the potential for concurrency conflicts. But that is still OK with us. Our entities would be versioned and optimistic concurrency would be enabled. > 2. When a user saves his changes, the interface XML list (where one or more elements have been deleted) is synchronised with the persistent list (e.g. hibernate merge) > [Radhakrishnan J.] Hmm, this is how we'd like to have it. And we'd would like to refrain from using merge. Like I mentioned, we'd like to synchronize the XML into the attached entity directly. > > My preference is 1), as it really simplifies any concurrency issues. Your particular application may of course dictate this. > > Hope that helps. > > Henrik > > On 11/29/06, [hidden email] <[hidden email]> wrote: > > Hi, > > > > We are using the presentation server in our application. We use Hibernate 3 as our persistence framework. We convert our object model to XML and vice-versa, for which we have a custom implementation of XML <-> Object transformer. However, we are facing challenges when it comes to XML -> Object. Here are some of the things that need to be taken care of, in our scheme of things: > > > > 1. Missing XML nodes need to result in objects getting removed from the persistent object graph. > > > > 2. Also, in our case, all the changes are written to the persistent version of the object graph. So the XML fragment of every entity needs to have the persistence id, and this needs to be used to obtain the appropriate persistent object and the changes be written to this object. > > > > Are there other users out there who use hibernate for persistence and the presentation server for view ? If so, I'd like to learn from your experiences. > > > > Thanks, > > Radhakrishnan > > > > > > > > > > -- > > You receive this message as a subscriber of the [hidden email] mailing list. > > To unsubscribe: mailto: [hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |