Title: XDoclet/Hibernate Component Issue

I ran into this problem and noticed some posts on various forums from users with the same problem. Some of these posts were almost a year old and I was wondering if there has been any progress on the following problem:

 
If you use the @hibernate.component tag more than once in one class for the same component type, this generates errors with Hibernate.

For example, if you had a Person class and you modeled an address using an Address class, it would make sense to model it using components as follows:

        Address homeAddress;
        Address businessAddress;
       
        /**
         * @hibernate.component
         */
        public Address getHomeAddresss();

        /**
         * @hibernate.component
         */
        public Address getBusinessAddress();

If you use XDoclet/Hibernate as-is this generates a duplicate field error.

One solution to this problem would be to prefix the fields imported from the component's class with the component's variable name; for example, in the case above you would get following fields generated;

        - homeAddress_street, homeAddress_city, homeAddress_state
        - businessAddress_street, businessAddress_city, businessAddress_state

Perhaps there could be a property for @hibernate.component called "prefix" that allows the user to override the default naming convention.

Are there any other workarounds or solutions to this problem that I'm not aware of?

Thanks,
Jack

Reply via email to