users@jaxb.java.net

Re: Plugin for EJB 3.0 annotations

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Tue, 16 Aug 2005 20:44:05 -0700

Scott Allan wrote:
> Attached is my first version of a ejb3 annotation plugin. I apologize
> for its lack of sophistication. There are very few validations and
> info/error messages at this point.

Nice! Thanks for sharing this.

It would be nice if this add-on would be hosted on java.net. The
jaxb-commons project seems like an excellent place to host this,
assuming that Lexi the project owner is OK with it. It makes it easier
for others to contribute. Lexi, how do you think?

Looking at the way you designed annotations, I wonder if it can be
improved. For example, instead of:

> <xs:complexType name="personType">
> <xs:annotation><xs:appinfo>
> <ejb3:annotate>
> <ejb3:annotation className="javax.persistence.Entity" type="class">
> <ejb3:param label="myparam1" stringValue="myvalue1"/>
> <ejb3:param label="myparam2" stringValue="myvalue2"/>
> </ejb3:annotation>

What about:

> <xs:complexType name="personType">
> <xs:annotation><xs:appinfo>
> <ejb3:entity />
> <ejb3:table />

?

Similarly, instead of:

> <ejb3:annotation className="javax.persistence.Id" type="getter">
> <ejb3:param label="generate" enumClass="javax.persistence.GeneratorType" enumValue="AUTO"/>
> </ejb3:annotation>

how about:

> <ejb:Id generate="AUTO" />

?


I also wonder if your plugin can automatically infer the necessary EJB3
annotations from schemas as much as possible. I'm not an EJB expert, so
I'm not too sure, but for example I'd imagine you need to put @Entity on
every persistable class. If so, isn't it easier if you just put them on
all classes, without asking the user to put <ejb3:Entity /> on every
complex type?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com