Title: RE: [Xdoclet-user] Xdoclet 1.2b3 will not merge hibernate compos ite key

I am trying to get this:
<hibernate-mapping>
    <class name="model.trial.ECPromoECItemRelation" table="ECPromoECItem">
        <composite-id name="relation" class="model.trial.ECPromoECItemRelation">
                <key-property name="promoId" type="int" column="promoId"/>
              <key-property name="itemId" type="int" column="itemId"/>
        </composite-id>
    </class>
</hibernate-mapping>

But keep getting this: (generated from class below)

<hibernate-mapping>
    <class name="model.trial.ECPromoECItemRelation" table="ECPromoECItem">
        <composite-id name="relation" class="model.trial.ECPromoECItemRelation">
                <key-property name="promoId" type="int" column="promoId"/>
              <key-property name="itemId" type="int" column="itemId"/>
        </composite-id>

        <property name="promoId" type="int" column="promoId"/>
        <property name="itemId" type="int" column="itemId"/>
    </class>
</hibernate-mapping>

Xdoclet is only doing what I tell it to do, so the way I have my composite class set up is probably the problem.  Just frustrating since all i had to do before (xdoclet beta2) was merge in the composite id element ;)

and thanks for the help ;)


here's the class for reference
/**
 * @hibernate.class
 *      table="ECPromoECItem"
 */
public class ECPromoECItemRelation implements Serializable {

    private int promoId   = -1;
    private int itemId    = -1;
    public ECPromoECItemRelation() {}

    /**
     * Constructs the Releation with the promoId and itemId.
     * @param promoId
     * @param itemId
     */
    public ECPromoECItemRelation(long promoId, long itemId)
    {
        String promoIdStr = String.valueOf(promoId);
        setPromoId(Integer.parseInt(promoIdStr));

        String itemIdStr = String.valueOf(itemId);
        setItemId(Integer.parseInt(itemIdStr));
    }

    /**
     * This is a work around to enable xdoclet to correctly generate the hibernate
     * xml mapping file.
     * @hibernate.id
     *      generator-class="assigned"
     * @return this object
     */
    private ECPromoECItemRelation getRelation(int promoId, int itemId) {
        return new ECPromoECItemRelation(promoId, itemId);
    }

    private void setRelation(ECPromoECItemRelation relation)
    {}

    /**
     * @hibernate.property
     */
    public int getPromoId()             { return promoId; }
    public void setPromoId(int promoId) { this.promoId = promoId; }

    /**
     * @hibernate.property
     */
    public int getItemId()              { return itemId; }
    public void setItemId(int itemId)   { this.itemId = itemId; }

    public boolean equals(Object obj) {
        if(!(obj instanceof ECPromoECItemRelation)) {
            return false;
        }

        ECPromoECItemRelation inRel = (ECPromoECItemRelation)obj;
        return this.getItemId() == inRel.getItemId() &&
                this.getPromoId() == inRel.getPromoId();
    }

    public int hasCode() {
        int result = 17;
        result = 37 * result + getItemId();
        result = 37 * result + getPromoId();
        return result;
    }
}


> -----Original Message-----
> From: Konstantin Priblouda [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 04, 2003 10:36 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [Xdoclet-user] Xdoclet 1.2b3 will not merge hibernate
> compos ite key
>
>
>
> > The issue is with Xdoclet because Xdoclet requires
> > you to now (as of beta3)
> > have some sort of id or composite id for hibernate
> > mapping file generation.
>
> AFAIK, this is also hibernate requirement. It will
> bomb if there is not ID defined in class mapping... So
> IMHO XDoclet behaves correctly. ( at least in this
> case )
>
> What do you like to get generated by xdoclet?
>
> > Did you read the whole thread?
>
> Hopefully... With all those virii I'm releting 500+
> emails a day and something could slip....
>
> regards,
>
> =====
> ----[ Konstantin Pribluda ( ko5tik ) ]----------------
> Zu Verst�rkung meines Teams suche ich ab Sofort einen
> Softwareentwickler[In] f�r die Festanstellung.
> Arbeitsort: Mainz
> Skills:  Programieren, Kentnisse in OpenSource-Bereich
> ----[ http://www.pribluda.de ]------------------------
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>

Reply via email to