views:

32

answers:

0

Hi all,

I want Hyperjab3 to persist with association like ManyToOne. Here is my example :

 <xsd:complexType name="Service">
  <xsd:sequence>
   <xsd:element name="id" type="xsd:string" minOccurs="1" maxOccurs="1">
    <xsd:annotation>
     <xsd:appinfo>
      <hj:id/>
     </xsd:appinfo>
    </xsd:annotation>
   </xsd:element>
   <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="Counter">
  <xsd:sequence>
   <xsd:element name="id" type="xsd:string" minOccurs="1" maxOccurs="1">
    <xsd:annotation>
     <xsd:appinfo>
      <hj:id/>
     </xsd:appinfo>
    </xsd:annotation>
   </xsd:element>
   <xsd:element name="service" type="Service" minOccurs="1" maxOccurs="1"/>
  </xsd:sequence>
 </xsd:complexType>

It seems to be ok for the generated java classes.

But in the XML file, i have this:

_For service

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dao.impl.xsd.Service>
 <id>IDService</id>
 <name>Awesome_Service</name>
</dao.impl.xsd.Service>

_For Counter

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dao.impl.xsd.Counter>
 <id>CounterTest</id>
 <service>
  <id>IDService</id>
  <name>Awesome_Service</name>
 </service>
</dao.impl.xsd.Counter>

As you can see, service is persist twince, once in his file, and once in the associated class file.

How to only persist the reference in Counter ? Have i to do it myself by replace the Service Type by the Service id type ?

Thank you.