Hi Werner
The generated extra methods do not work with hibernate as the method
signature of the setXXXAsReference is java.util.ArrayList rather than
java.util.List. This causes an IllegalArgumentException when trying to
persist with Hibernate.
if I change public void setXXXAsReference(java.util.ArrayList collection) to
public void setXXXAsReference(java.util.List collection), the
IllegalArgumentException goes away and everything works fine with hibernate.
I fixed this by changing the generated code. Is there any configuration
option I could use to get around this?
James
----- Original Message -----
From: "Werner Guttmann" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, June 27, 2007 12:55 PM
Subject: Re: [castor-user] source generator arraylist
James,
there's a property in 'castorbuilder.properties' that allows you to
exhibit some control over that area of interest.
# Enables generation of extra methods for collection fields, such as
get/set by
# reference and set as copy. Extra methods are in addition to the usual
# collection get/set methods. Set this to true if you want your code to
be
# more compatible with Castor JDO.
# False by default.
#
#org.exolab.castor.builder.extraCollectionMethods=true
And I just noticed that this property is missing from the relevant HTML
documentation. Can I ask you to please create a new Jira issue asking us
to add this ?
Regards
Werner
James Cowan wrote:
Hi
Is it possible to change the way that the SourceGenerator generates
array access methods via configuration?
For example, the xsd element <xsd:element name="address" type="Address"
maxOccurs="unbounded"/> generates
public Address[] getAddress() and public void setAddress(Address []).
I would like to generate in addition public ArrayList getAddressList()
and public void setAddressList(ArrayList list).
The reason for this is that Hibernate can lazily load collections but
not arrays.
James
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email