users@jaxb.java.net

Re: _at_annotation customization

From: Lucas Jordan <lucasjordan_at_gmail.com>
Date: Mon, 6 Nov 2006 14:19:18 -0500

which plugin? I guess I don't have much experience with JAXB plugins, can
they be integrated into netbeans? I am using netbeans to create a web
service, so I am not directly using jaxb....perhaps I will need to.

As for hyperjaxb3, that looks like it is a long way from a finished product.
has any one had any luck using it?

thanks all!
-Lucas

On 11/6/06, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> Lucas Jordan wrote:
> > Is it possible to add annotations to the generated classes by adding
> > annotation elements to an xsd file. For example, I would like to add an
> > @Entity attribute to each generated class as well as an @Id attribute
> (plus
> > maybe an @GeneratedValue) to selected fields.
>
> Plugin lets you do this kind of things easily.
>
> And if you are specifically looking for persistence annotations, check
> out https://hyperjaxb3.dev.java.net/
>
> Also search the archive of this list for the EJB3/JPA and JAXB related
> discussions, and in particular updates from Lexi about the status of
> hyperjaxb3.
>
>
> > So, If I have an xsd file that looks something like:
> >
> > <xsd:element name="Address" type="tns:AddressType"/>
> > <xsd:complexType name="AddressType">
> > <xsd:sequence>
> > <xsd:element name="Id" type="xsd:long"/>
> > <xsd:element name="Street" type="xsd:string"/>
> > <xsd:element name="City" type="xsd:string"/>
> > <xsd:element name="Zip" type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> >
> > I would like to have a class like:
> >
> > @XmlAccessorType(XmlAccessType.FIELD)
> > @XmlType(name = "AddressType", propOrder = {
> > "street",
> > "city",
> > "zip"
> > })
> > @Entity()
> > public class AddressType implements Serializable{
> >
> > @XmlElement(name = "SId", namespace = "
> > http://xml.netbeans.org/schema/Types", required = true)
> > @Id @GeneratedValue long id;
> > @XmlElement(name = "Street", namespace = "
> > http://xml.netbeans.org/schema/Types", required = true)
> > protected String street;
> >
> >
> > ..
> > }
> >
> > thanks!
> > -Lucas
> >
> > P.S. Currently I am hand editing each class by adding the annotations,
> this
> > works, but makes development a pain, since I have to remember which
> classes
> > are annotated how when ever I rebuild the classes.
> > P.P.S Obviously I am trying use the generated class with the Java
> > Persistence API, If anyone has a good solution to this, I would love to
> hear
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>