Hello all

(Second time I've sent this - first one didn't get through.. apologies if
this arrives twice...)

Is there a hibernate expert out there who knows how to do inheritance with
hibernatedoclet?

I have this problem - I'm wanting to persist a class that inherits its ID
from a base class, but hibernatedoclet seems unable to do this. For example:

public class Base
{
        private int id;

        /**
         * @hibernate.id generator-class="assigned"
         */
        private int getId()
        {
                return id;
        }
        private void setId(int id)
        {
                this.id = id;
        }
}

/**
 * @hibernate.class table="Sub"
 */
public class Sub extends Base
{
        private String name;

        /**
         * @hibernate.property
         */
        private String getName()
        {
                return name;
        }
        private void setName(String name)
        {
                this.name = name;
        }
}




So, I'm wanting the Sub class to pick up the id property from Base, and thus
have hibernatedoclet generate the mapping file with id as it's ID field.
However, xdoclet doesn't seem to have any concept of this. The only way I
can see of doing this would be:


/**
 * @hibernate.class table="Sub"
 */
public class Sub extends Base
{
        private String name;

        /**
         * @hibernate.property
         */
        private String getName()
        {
                return name;
        }
        private void setName(String name)
        {
                this.name = name;
        }

        /**
         * @hibernate.id generator-class="assigned"
         */
        private int getId()
        {
                return super.getId();
        }
        private void setId(int id)
        {
                super.setId(id);
        }
}



which seems rather a lot of work to implement my inheritance hierarchy! In
every class, I'd need to include the get/set methods for my ID attribute!

Anybody got any ideas on this? Right now, I don't see how I can use
hibernatedoclet in anything but the simplest of cases (that is, where
there's no inheritance of attributes), and I'm going to have to use
Hibernate's MapGenerator tool to generate skeleton mapping files, and then
complete them by hand.

I did think that maybe merge points were the answer, but these seem to do
their work *after* xdoclet rather than before - I'd like to be able to
insert the superclass method declarations and xdoclet tags before
hibernatedoclet did its thing.

Any help much appreciated...

Craig

Chief Architect
Dyosoft Systems Limited
http://www.dyosoft.com
mailto:[EMAIL PROTECTED]

Chief Architect
Dyosoft Systems Limited
http://www.dyosoft.com
mailto:[EMAIL PROTECTED]




-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to