Paul Tomsic wrote:
I've got the following class that represents a
join-table with an additional column.

public class GroupChoice implements Serializable {
    public static class Id implements Serializable {
          private Long _groupId;
          private Long _choiceId;
          public Id(Long groupId, Long choiceId) {
             this._groupId = groupId;
             this._choiceId = choiceId;
          }
public boolean equals(Object o) {

            return true;

        }

        public int hashCode() {
return 29;
        }

    }
    private Group group;
    private Choice choice;
    public GroupChoice(Group g, Choice c) {
        this._group = g;
        this._choice = c;
    }

    /**
     * @hibernate.id
     */
    public GroupChoice.Id getId() {
        return new GroupChoice.Id(_group.getId(),
_choice.getId());
    }

The error I'm getting is:
Composite ID property of type GroupChoice.Id is
invalid.  It has to be serializable and reimplement
equals(Object)

What am I doing wrong here?


Probably nothing, but to be sure, you should implement the Id propert accessors and mutators in the id class, and put @hibernate.property tags on them.

Xdoclet's checks for the serializable and equals requirements on composite Id classes is proving to be troublesome, and I think unnecessary...I'm aiming, for the 1.3 release, to have people move towards explicity using a @hibernate.composite-id tag to specify composite ID's so that this checking doesn't need to be done at all.



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
xdoclet-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to