-->
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.  [ 1 post ] 
Author Message
 Post subject: Generate XML from an entity
PostPosted: Tue May 29, 2007 9:33 am 
Newbie

Joined: Tue May 29, 2007 9:25 am
Posts: 1
Hi,
In my application i generate an xml file from entity beans,
before i run
manger.persist(entity);

my generated xml looks like:

Code:
<rollingstock>
  <rollingstockId>0</rollingstockId>
  <route>Stockholm</route>
  <nextRoute>Uppsala</nextRoute>
  <schedule>
    <id>0</id>
    <destination>destination</destination>
  </schedule>
  <vehicles>
    <vehicle>
      <id>0</id>
      <vehicleId>1412</vehicleId>
      <litt>litt</litt>
      <ticketId>1412</ticketId>
      <vehicleType>vehicleType</vehicleType>
      <weight>
        <weight>78.0</weight>
      </weight>
      <dynamicWeight>
        <weight>78.0</weight>
      </dynamicWeight>
      <brakeWeight>
        <weight>110.0</weight>
      </brakeWeight>
      <length>
        <length>155.3</length>
        <unit>M</unit>
      </length>
      <nrOfAxles>4</nrOfAxles>
      <speed>
        <speed>160.0</speed>
        <unit>s</unit>
      </speed>
      <service>PULLING</service>
      <canDoorsBeLocked>true</canDoorsBeLocked>
      <phoneNumbers>
        <phonenumber>
          <id>0</id>
          <location>Ahytt</location>
          <number>0148782373</number>
        </phonenumber>
      </phoneNumbers>
      <passengerCarConfiguration>
        <id>0</id>
        <class1>10</class1>
        <class2>10</class2>
        <couchette>5</couchette>
        <compartments>10</compartments>
      </passengerCarConfiguration>
      <comments>
        <comment>
          <id>0</id>
          <comment>Comment about this vihicle</comment>
        </comment>
      </comments>
      <nextAssignment>9010</nextAssignment>
      <schedule reference="../../../schedule"/>
      <nextSchedule reference="../../../schedule"/>
      <positionInTrainAssembly>0</positionInTrainAssembly>
    </vehicle>
  </vehicles>
</rollingstock>


After:

Code:
<rollingstock>
  <rollingstockId>4200</rollingstockId>
  <route>Stockholm</route>
  <nextRoute>Uppsala</nextRoute>
  <schedule>
    <id>4200</id>
    <destination>destination</destination>
  </schedule>
  <vehicles class="org.hibernate.collection.PersistentBag">
    <bag>
      <vehicle>
        <id>3700</id>
        <vehicleId>1412</vehicleId>
        <litt>litt</litt>
        <ticketId>1412</ticketId>
        <vehicleType>vehicleType</vehicleType>
        <weight>
          <weight>78.0</weight>
        </weight>
        <dynamicWeight>
          <weight>78.0</weight>
        </dynamicWeight>
        <brakeWeight>
          <weight>110.0</weight>
        </brakeWeight>
        <length>
          <length>155.3</length>
          <unit>M</unit>
        </length>
        <nrOfAxles>4</nrOfAxles>
        <speed>
          <speed>160.0</speed>
          <unit>s</unit>
        </speed>
        <service>PULLING</service>
        <canDoorsBeLocked>true</canDoorsBeLocked>
        <phoneNumbers class="org.hibernate.collection.PersistentSet">
          <set>
            <phonenumber>
              <id>3600</id>
              <location>Ahytt</location>
              <number>0148782373</number>
            </phonenumber>
          </set>
          <initialized>true</initialized>
          <cachedSize>-1</cachedSize>
          <dirty>false</dirty>
          <storedSnapshot class="map">
            <entry>
              <phonenumber reference="../../../set/phonenumber"/>
              <phonenumber reference="../../../set/phonenumber"/>
            </entry>
          </storedSnapshot>
        </phoneNumbers>
        <passengerCarConfiguration>
          <id>3600</id>
          <class1>10</class1>
          <class2>10</class2>
          <couchette>5</couchette>
          <compartments>10</compartments>
        </passengerCarConfiguration>
        <comments class="org.hibernate.collection.PersistentSet">
          <set>
            <comment>
              <id>3600</id>
              <comment>Comment about this vihicle</comment>
            </comment>
          </set>
          <initialized>true</initialized>
          <cachedSize>-1</cachedSize>
          <dirty>false</dirty>
          <storedSnapshot class="map">
            <entry>
              <comment reference="../../../set/comment"/>
              <comment reference="../../../set/comment"/>
            </entry>
          </storedSnapshot>
        </comments>
        <nextAssignment>9010</nextAssignment>
        <schedule reference="../../../../schedule"/>
        <nextSchedule reference="../../../../schedule"/>
        <positionInTrainAssembly>0</positionInTrainAssembly>
      </vehicle>
    </bag>
    <initialized>true</initialized>
    <cachedSize>-1</cachedSize>
    <dirty>false</dirty>
    <storedSnapshot class="list">
      <vehicle reference="../../bag/vehicle"/>
    </storedSnapshot>
  </vehicles>
</rollingstock>



as you see hibernate add hibernate specific information to the POJO as:
Code:
    <initialized>true</initialized>
    <cachedSize>-1</cachedSize>
    <dirty>false</dirty>
    <storedSnapshot class="list">
      <vehicle reference="../../bag/vehicle"/>
    </storedSnapshot>

is it possible to get an xml as it look like before the manager.persist call.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.