-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: 3.0.2 appears to have introduced a bug in EntityMode.DOM4J
PostPosted: Wed Apr 27, 2005 12:02 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Hibernate version:3.0.2


I have included the output of running this identical process using the 3.0.1 hibernate.jar and the just released 3.0.2 jar.
Below there are two xml fragments, one for each version.
For some reason, using the 3.0.2 release, the <set> mappings for "races" and "ethnicities" appear in the document twice. At the beginning, and also at the end. (Note: actual tests contained several more property mappings which were removed for brevity.)

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="PersonVO" table="PRSN" node="person">
    <id column="PRSN_ID" name="personId" type="java.lang.Long">
       <generator class="native"/>
    </id>
    <timestamp column="LST_MODIFIED_ON"  name="timeLastModified"/>
    <set name="ethnicities" table="PRSN_ETHNICITY" inverse="true" cascade="all,delete-orphan">
       <key column="PRSN_ID"/>
       <one-to-many class="PersonEthnicityVO"/>
    </set>
    <set name="races" table="PRSN_RACE" inverse="true" cascade="all,delete-orphan" >
       <key column="PRSN_ID"/>
       <one-to-many class="PersonRaceVO"/>
    </set>
  </class>
</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="PersonRaceVO" table="PRSN_RACE" node="person-race">
    <id column="PRSN_RACE_ID" name="personRaceId" type="java.lang.Long">
       <generator class="native"/>
    </id>
    <many-to-one column="PRSN_ID" name="person" class="PersonVO" not-null="true" embed-xml="false"/>
    <many-to-one column="RACE_DMGR_ID" name="raceDmgr" class="RaceDmgrVO" not-null="true" embed-xml="false"/>
  </class>
</hibernate-mapping>

... PersonEthnicityVO mapping is almost identical to above...


Code between sessionFactory.openSession() and session.close():
Code:
      XMLWriter writer = ... create new XMLWriter

      Session s = session.getSession(EntityMode.DOM4J);
      List results = s.createQuery("from ClientVO client").list();
      for (Iterator i = results.iterator(); i.hasNext();) {
         Element e = (Element) i.next();
         writer.write(e);
      }
      ... close writer


3.0.1 results
Code:
  <person>
    <personId>1</personId>
    <timeLastModified>2005-03-29 11:34:04</timeLastModified>
    <ethnicities>
      <person-ethnicity>
        <personEthnicityId>448012</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>1</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448011</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>102</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448034</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>103</ethnicityDmgr>
      </person-ethnicity>
    </ethnicities>
    <races>
      <person-race>
        <personRaceId>460016</personRaceId>
        <person>1</person>
        <raceDmgr>1</raceDmgr>
      </person-race>
      <person-race>
        <personRaceId>460014</personRaceId>
        <person>1</person>
        <raceDmgr>3</raceDmgr>
      </person-race>
    </races>
  </person>


3.0.2 results
Code:
  <person>
    <personId>1</personId>
    <ethnicities>
      <person-ethnicity>
        <personEthnicityId>448012</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>1</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448011</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>102</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448034</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>103</ethnicityDmgr>
      </person-ethnicity>
    </ethnicities>
    <races>
      <person-race>
        <personRaceId>460016</personRaceId>
        <person>1</person>
        <raceDmgr>1</raceDmgr>
      </person-race>
      <person-race>
        <personRaceId>460014</personRaceId>
        <person>1</person>
        <raceDmgr>3</raceDmgr>
      </person-race>
    </races>
    <timeLastModified>2005-03-29 11:34:04</timeLastModified>
    <ethnicities>
      <person-ethnicity>
        <personEthnicityId>448012</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>1</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448011</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>102</ethnicityDmgr>
      </person-ethnicity>
      <person-ethnicity>
        <personEthnicityId>448034</personEthnicityId>
        <person>1</person>
        <ethnicityDmgr>103</ethnicityDmgr>
      </person-ethnicity>
    </ethnicities>
    <races>
      <person-race>
        <personRaceId>460016</personRaceId>
        <person>1</person>
        <raceDmgr>1</raceDmgr>
      </person-race>
      <person-race>
        <personRaceId>460014</personRaceId>
        <person>1</person>
        <raceDmgr>3</raceDmgr>
      </person-race>
    </races>
  </person>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 12:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please submit to JIRA, Thanks


Top
 Profile  
 
 Post subject: Re: 3.0.2 appears to have introduced a bug in EntityMode.DOM
PostPosted: Wed Apr 27, 2005 12:07 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Note: In an attempt to simplify the problem for this post, I missed one change for the query. It should read as follows:

Code:
List results = s.createQuery("from PersonVO client").list();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 12:16 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
gavin wrote:
Please submit to JIRA, Thanks


One question... should I post all of this info in JIRA or simply refer to this forum entry ?

Thanks for the (unbelievably) quick reply.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 1:48 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
on jira: explain all this + if you can attach a zipped testcase
once done, here, just add a link to the jira issue

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 5:15 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Issue Opened in JIRA

http://opensource.atlassian.com/project ... se/HHH-406


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 29, 2005 9:44 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
pksiv wrote:


This is fixed in CVS as of 6:30am on 4/29/2005

Thanks for the unbelievably quick turn-around.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.