> > Class A
> > |-bar (field)
> > |
> > \-> B extends A
> >     |-getBar() { return super.getBar(); }
> >     |
> >     \-> C extends B generated by Xdoclet
> >       |- getBar() { return this.bar; }
> >
> > Ack! Is there anyway I can get XDoclet to NOT generate fields that
> already
> > exist in super classes? Those super classes have methods which touch
> their
> > own fields, so that when called they do not 'see' fields set through
> > C.setBar().
>
>
> Is it what you've done?
> You have persistent field in class A (@ejb:persistent-field). When you
> run xdoclet it CCMP for example, with get/set for that field from a
> base. Right?
> But wait a minute! Are those getter/setter in class A declared abstract?
> Remember this the pattern that xdoclet follows:
> You don't declare persistent fields, you declare getter/setter for that
> field and put a @ejb:persistent-field in getter. Then if using ejb 1.1 a
> concrete class is generated deriving from your bean with a field
> declaration in it, plus getter/setter implemented. If no
> @ejb:persistent-field then nothing implemented in generated class. For
> ejb 2 and cmp 2.x we don't add anything else, it uses ejb 2's abstract
> schema.

Class A was not written by me so I cannot modify it, but it contains
persistent fields and getter / setter. I've extended it in Class B so that
XDoclet can create persistent fields like so:

        /**
         * @ejb:persistent-field
         */
        public Foo getBar()
        {
                return super.getBar();
        }

My point is that if the fields already exist (as they do here) I want
XDoclet to generate a DD for them, but not create a new field in class C!
XDoclet generates this:

        Foo bar;

        public Foo getBar()
        {
                return bar;
        }

which obviously means that the C.bar overrides A.bar. _However_ there are
other methods in A and B which depend on / use the fields in A, not C - so
you end up with an inconsistent bean (discovered during Unit testing).

How can I tell XDoclet to 'ignore bar in the generation and trust me it
already exists'? I want it to churn out code in C like :

        public Foo getBar()
        {
                return super.getBar();
        }

I have a sneaking suspicion that you're going to tell me it's just not
possible - which bites bigtime because it rules a lot of EJBs out of being
XDoclet generated.

-mike

Mike Cannon-Brookes :: [EMAIL PROTECTED]

Atlassian :: http://www.atlassian.com
     Supporting YOUR J2EE World



_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to