users@jaxb.java.net

Re: Marshalling hibernate object with lazy loading

From: <lucasjordan_at_SoftHome.net>
Date: Wed, 12 Apr 2006 18:41:36 -0600 (MDT)

Thanks, I assume that is an annotation for the each class (Address in this
case). Can I make jaxb create the classes with that annotation?

-Lucas


> Hi Lucas,
>
> Yes - @XmlAccessType(XmlAccess.PROPERTY).
>
> cheesr
> dim
>
> On 4/13/06, Lucas Jordan <lucasjordan_at_softhome.net> wrote:
>> I'm not sure if this is a jaxb2 issue or a hibernate issue, but I am
>> having
>> some trouble marshalling objects that are returned by hibernate.
>>
>> If I have objects that are something like:
>> <xsd:complexType name="Address" >
>> <xsd:sequence>
>> <xsd:element name="Street" type="xsd:string" minOccurs="0"
>> maxOccurs="1"/>
>> <xsd:element name="City" type="xsd:string" minOccurs="0"
>> maxOccurs="1"/>
>> <xsd:element name="State" type="xsd:string" minOccurs="0"
>> maxOccurs="1"/>
>> <xsd:element name="Zip" type="xsd:string" minOccurs="0"
>> maxOccurs="1"/>
>> </xsd:sequence>
>> </xsd:complexType>
>>
>> and I create a hibernate mapping that looks something like:
>> <hibernate-mapping auto-import="true" default-access="property"
>> default-cascade="none" default-lazy="false">
>> <class dynamic-insert="false" dynamic-update="false" mutable="true"
>> name="org.chip.aegis.schemas.edvisit.Address" optimistic-lock="version"
>> polymorphism="implicit" select-before-update="false">
>> ...
>> </class>
>> </hibernate-mapping>
>>
>>
>> With default-lazy="false" I have no trouble, but when I set
>> default-lazy="true" I get back from hibernate Address objects that are
>> modified, and when I marshal these objects all of the fields in that
>> object
>> are null.
>>
>> By modified, I think I mean that they are byte code injected versions of
>> address.
>>
>> I assume hibernate has modified the address objects so the values of
>> 'street', 'city', etc, are loaded from the DB when the method getStreet
>> is
>> called and the inner field 'street' is always null.
>>
>>
>> Does jaxb use the get/set methods to access the values of properties or
>> the
>> direct access to the private fields. Is there any way to force it use
>> the
>> get/set methods?
>>
>> Thanks
>> Lucas
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>