[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-422) xml entity bindings for subclass entities

Arturo Frappé (JIRA) noreply at atlassian.com
Wed Aug 26 14:45:16 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33853#action_33853 ] 

Arturo Frappé commented on HHH-422:
-----------------------------------

I don't understand if my problems fits exaclty in this issue, I think that my issue is more similar than  HHH-681.

Here are my findings: 
I have a  collection with an element which its xml-node-name is "medicion" 

<subclass name="NotaMedicaNueva" discriminator-value="49">           
         . . . 
            <set name="mediciones" order-by="TM_EVENTO DESC" where="ID_MEDICION IN(303,103,108)" node="signos-vitales" embed-xml="true">
                <key>
                    <column name="TM_EVENTO" length="23" />
                    <column name="CV_CURP" length="18" />
                </key>
                <one-to-many class="MedicionPaciente" node="medicion" embed-xml="true"/>
            </set>
        . . .
</subclass>

My issue raises when loading an element of this collection, at getRow() method of OneToManyLoader.java, the first run the element loads, but at line 127 of PersistentElementHolder.java its node name is interchanged by those writen in the node=" " configuration attribute.
Then when the second element is loaded, at the call instanceAlreadyLoaded() on OneToManyLoader::getRow() fails. 
I think that this issue could be solved if  Dom4jInstantiator::isInstance works considering the interchange. 
Surely rewriting this: 

public Dom4jInstantiator(Component component) {
		this.nodeName = component.getNodeName();
		isInstanceNodeNames.add( nodeName );
	}

to consider the ElementNodeName already seted by node=" "

Since I'm not an expert of this piece of code I don't know if doing this will have a side effect on other parts of the code. 




> xml entity bindings for subclass entities
> -----------------------------------------
>
>                 Key: HHH-422
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-422
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.0.2
>         Environment: Hibernate cvs head from main branch .(As of 4/28/05..So 3.0.2?), Oracle 8i. 
>            Reporter: Jesse Kuhnert
>            Assignee: Steve Ebersole
>             Fix For: entity-modes
>
>         Attachments: XMLSubclassTest.zip
>
>   Original Estimate: 1 week
>  Remaining Estimate: 1 week
>
> I'm sure someone else is already in the process of agnonizing over how to handle the entity name resolution issues that are currently floating around in the codebase, but for the sake of not knowing who's doing what and what-not (heh), I thought I would share my couple quick notes learned from trying to make this work today. 
> I was having problems getting an import of xml data into hibernate with derived subclasses of one base class. (Not abstract, derived using the discriminator value column and table per subclass method). Was getting lots of errors trying to map my subclass nodes into the main xml document, even if I named the child nodes the same as the parent. The only eventual temporary solution I could find was by adding the subclass  "node name" values into the two Map instances I could find that needed these references. [Mappings class and EntityPersister, ughh I've forgotten the other ones name now. ] 
> The one main culprit already had an obvious method comment with a TODO tag so I'm sure someone is already working on a much better longterm solution than mine.. The only thing I didn't complete was having the ability for the subclass instances to have their own node names. Ie if I had an instance of the base class mapped as a many-to-XX collection in someone's class, I had to specify a node name of "something" to get it to be recognized. I didn't get far enough in my day to get this part as well, but I think it would just require being able to reference the current child somehow. Some sort of XSLT expression like "name()" or "self" perhaps? 
> After that everything worked beautifully of course :) Will be very excited to see this feature come to full bloom, as I plan on using it to synchronize some data points with customer databases sometime this summer? (Am I being too hopeful? I'd love to help, but I'm sure there are plenty of good people doing things already..And I'm I'm fu#$!@ with my own deadlines anyways...) 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list