In a fit of desperation I've tried to completely restructure the code to not use the *PKey.java sub-objects. Instead I'm embedding the @hibernate.key-property tags directly in the class.
This has
partially worked, but I've run into an error loop with XDoclet. If I implement the code as below, I get an error:
Quote:
Attribute "name" is required and must be specified for element type "key-property"
However, if I define the name property as in the snippet below, I get another error:
Quote:
"name is an invalid parameter name."
This error loop occurs with both XDoclet2 1.0.3 and 1.0.4. I'd originally downgraded to 1.0.3 thinking it was an error in the 1.0.4 code, but apparently the problem has been around longer than I thought.
Thanks in advance for any help you can provide.
Code:
package com.msobkow.admobile.advdb.rec;
import java.io.Serializable;
import java.util.List;
import java.util.Calendar;
import com.msobkow.admobile.advdb.info.AdvDbInfoCheck;
/**
* AdvDbAdCategoryBean implements data attribute mapping for the
* table advdb.ad_category
* using XDoclet2 and Hibernate 3.
* <p>
* Note that if you are setting a required attribute that is implemented
* by an object (e.g. String, Timestamp), the setter will throw an exception
* when you try to set it to a <tt>null</tt> value because the copy
* constructors expect a value to copy.
* <p>
* Range checking will similarly fail if you don't pass an appropriate object
* to the setter.
* <p>
* If it's the <i>database</i> that has bad data, the information is still set
* into the I/O buffer because the EJB2 I/Os directly access the attributes
* rather than going through the getters and setters. Not only is this more
* efficient, it allows the code to bring bad data forward from the database
* to the application so that it can be corrected and updated.
*
* @hibernate.mapping
* auto-import="true"
* default-access="field"
* package="com.msobkow.admobile.advdb.rec"
* @hibernate.class
* mutable="true"
* optimistic-lock="all"
* catalog="advdb"
* schema="advdb"
* table="ad_category"
* dynamic-insert="true"
* dynamic-update="true"
* lazy="true"
* @hibernate.cache
* usage="nonstrict-read-write"
*/
public class AdvDbAdCategoryBean
implements Serializable,
AdvDbAdCategoryXfc
{
/**
* The Unique class Id for this object.
*/
public long serialVersionUID = 20080402210200003L;
/**
* @hibernate.composite-id
*/
/**
* AdvertId maps the database column ad_category.advert_id.
*
* @hibernate.key-property
* type="long"
* access="field"
* column="advert_id"
*/
long advertId;
/**
* CategoryId maps the database column ad_category.category_id.
*
* @hibernate.key-property
* type="long"
* access="field"
* column="category_id"
*/
long categoryId;
/**
* Master foreign key Advert references AdvDbAdvertBean
*
* @hibernate.many-to-one
* optimistic-lock="true"
* class="com.msobkow.admobile.advdb.rec.AdvDbAdvertBean"
* access="field"
* not-null="true"
* outer-join="true"
* embed-xml="false"
* not-found="exception"
*/
AdvDbAdvertBean refAdvert;
/**
* Lookup foreign key Category references AdvDbCategoryBean
*
* @hibernate.many-to-one
* optimistic-lock="true"
* class="com.msobkow.admobile.advdb.rec.AdvDbCategoryBean"
* access="field"
* not-null="true"
* outer-join="true"
* embed-xml="false"
* not-found="exception"
*/
AdvDbCategoryBean refCategory;
public AdvDbAdCategoryBean() {
super();
advertId = -1L;
categoryId = -1L;
refAdvert = null;
refCategory = null;
}
public void resetAttributes() {
advertId = -1L;
categoryId = -1L;
refAdvert = null;
refCategory = null;
}
public long getAdvertId() {
return( advertId );
}
public void setAdvertId( long value ) {
advertId = value;
}
public long getCategoryId() {
return( categoryId );
}
public void setCategoryId( long value ) {
categoryId = value;
}
/**
* Get the Advert reference.
*
* @return The Advert reference.
*/
public AdvDbAdvertBean getAdvert() {
return( refAdvert );
}
/**
* Set the Advert reference.
*
* @param ref The reference to set.
*/
public void setAdvert( AdvDbAdvertBean ref ) {
refAdvert = ref;
}
/**
* Get the Category reference.
*
* @return The Category reference.
*/
public AdvDbCategoryBean getCategory() {
return( refCategory );
}
/**
* Set the Category reference.
*
* @param ref The reference to set.
*/
public void setCategory( AdvDbCategoryBean ref ) {
refCategory = ref;
}
}