Re: [hibernate-dev] embed-xml=false leaves you stuck
On Dec 11, 2007, at 8:02 PM, Bill Burke wrote: I was looking at the XML mapping support for Hibernate recently and have some questions/suggestions. One thing that seriously annoyed me was that if you do not have embed-xml=true you can never get access to an association/ relationship in XML format. This means that I cannot have embed- xml=false and load the relationship with a fetch join. Is there any particular reason I'm missing here on why it was implemented in this fashion? Consistency. Partially it has to do with avoiding circular references as you mention below, but that is really a choice for the person doing the mapping (hence why embed-xml is even an *option*). The bigger issue here imo is the fact that the nature of XML suggests that we are discussing structured data; structure which is generally described by a schema or DTD. What you do not like is the static nature of the choice... I am not an XML person. However, I believe there is an approach which would be great and which XML supports, but I am not certain. I am talking about representing the association as a link (potentially) to another part of the document describing the associated data on the basis that it may be shared: person id=1 nameBill Burke/name !- here, an 'employer' element would link to the company id=1/ reference below -- /person company id=1 ... /company Then, if the association data is uninitialized you would still have the link, but the entity data would not be included in the document. I think that would be a great feature/option and would gladly accept patches for that. ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev
Re: [hibernate-dev] embed-xml=false leaves you stuck
Steve Ebersole wrote: The bigger issue here imo is the fact that the nature of XML suggests that we are discussing structured data; structure which is generally described by a schema or DTD. What you do not like is the static nature of the choice... Schema can allow for partial documents. The EE 5 schema is one, but unrelated, example. I am not an XML person. However, I believe there is an approach which would be great and which XML supports, but I am not certain. I am talking about representing the association as a link (potentially) to another part of the document describing the associated data on the basis that it may be shared: person id=1 nameBill Burke/name !- here, an 'employer' element would link to the company id=1/ reference below -- /person company id=1 ... /company Then, if the association data is uninitialized you would still have the link, but the entity data would not be included in the document. I think that would be a great feature/option and would gladly accept patches for that. I've actually been thinking of implementing this, but not in the way you are talking about. Again, the problems resides with how hibernate currently implements DOM4J mode and I'm pretty sure that just plugging in a new tupleizer won't work. What I'm thinking of is a RESTful approach to interacting with hibernate over the web and using hyperlinks/URIs to reference associations/relationships. GET http://foo.com/customerdb/customers/434234 customer nameBill Burke/name addresshrefhttp://foo.com/customerdb/address/432/href/address accounts hrefhttp://foo.com/customerdb/customer/434234/accounts/href /accounts /customer If you wanted more data then just do: http://foo.com/customerdb/customers/434234?fetch=accountsfetch=address Then for updates send partial documents to server for updating PUT http://foo.com/customerdb/customers/434234 customer nameWilliam Burke/name /customer XML Schema could be used to control how partial a document could be. Another EntityMode I want to write is a Restful JSON one. I actually think this might be doable solely by writing a tuplelizer for the dynamic map mode, so I might prototype this first rather than fuck around with hibernate at all... -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev
Re: [hibernate-dev] embed-xml=false leaves you stuck
Probably the best strategy is to think about it when we work on the fetch profile strategy. On Dec 12, 2007, at 03:02, Bill Burke wrote: I was looking at the XML mapping support for Hibernate recently and have some questions/suggestions. One thing that seriously annoyed me was that if you do not have embed-xml=true you can never get access to an association/ relationship in XML format. This means that I cannot have embed- xml=false and load the relationship with a fetch join. Is there any particular reason I'm missing here on why it was implemented in this fashion? I know you have to worry about circular references, but isn't that something the user/app developer can worry about instead of Hibernate? I'll get into later why this is a problem for me... Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev
[hibernate-dev] why does dynamic-map mode eagerly load lazy collections
Same problem happening with dynamicMap mode. Problem is, by debugging/stepping through the code, I can't find out why a lazily loaded relationship is getting loaded. Any hints? Thanks, Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev
Re: [hibernate-dev] why does dynamic-map mode eagerly load lazy collections
H. I think the debugger is initializing the collection when I view it. I was trying to view the result in the debugger instead of a println LOL! sorry. Bill Burke wrote: Same problem happening with dynamicMap mode. Problem is, by debugging/stepping through the code, I can't find out why a lazily loaded relationship is getting loaded. Any hints? Thanks, Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ___ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev