I was trying to use the Persistent base class pattern.
I am using xdoclet tags to generate my hbm files.
All I get is "<XDocletMain.start 54 ) <<Class com.axium.poc.ContactInfo misses ID property>>" however...
I want it to use the ID from the Persistent base class. What am I doing wrong?
----------
package com.poc.base;
import net.sf.hibernate.*;
import java.io.Serializable;
import java.sql.SQLException;
/**
* @hibernate.class
*/
public abstract class Persistent implements Serializable {
protected Long _id;
protected int _version;
/**
* @hibernate.id
* column="id"
* generator-class="assigned"
*/
public Long getIdentifier() {
return _id;
}
public void setIdentifier(Long id) {
_id = id;
}
public int getVersion() {
return _version;
}
public void setVersion(int version) {
_version = version;
}
}
and
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 0.9.5.2</a>, using an XML
* Schema.
* $Id$
*/
package com.poc;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;
/**
* Class ContactInfo.
*
* @version $Revision$ $Date$
* @hibernate.class
* table="ContactInfo"
*/
public class ContactInfo extends ContactInfoType
implements java.io.Serializable
{
//----------------/
//- Constructors -/
//----------------/
public ContactInfo() {
super();
} //-- com.poc.ContactInfo()
//-----------/
//- Methods -/
//-----------/
/**
* Note: hashCode() has not been overriden
*
* @param obj
*/
public boolean equals(java.lang.Object obj)
{
if ( this == obj )
return true;
if (super.equals(obj)==false)
return false;
if (obj instanceof ContactInfo) {
ContactInfo temp = (ContactInfo)obj;
return true;
}
return false;
} //-- boolean equals(java.lang.Object)
/**
* Method isValid
*/
public boolean isValid()
{
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
} //-- boolean isValid()
/**
* Method marshal
*
* @param out
*/
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, out);
} //-- void marshal(java.io.Writer)
/**
* Method marshal
*
* @param handler
*/
public void marshal(org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, handler);
} //-- void marshal(org.xml.sax.ContentHandler)
/**
* Method unmarshal
*
* @param reader
*/
public static java.lang.Object unmarshal(java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
return (com.poc.ContactInfo) Unmarshaller.unmarshal(com.poc.ContactInfo.class, reader);
} //-- java.lang.Object unmarshal(java.io.Reader)
/**
* Method validate
*/
public void validate()
throws org.exolab.castor.xml.ValidationException
{
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
} //-- void validate()
}
and
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 0.9.5.2</a>, using an XML
* Schema.
* $Id$
*/
package com.poc;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;
/**
* Class ContactInfoType.
*
* @version $Revision$ $Date$
* @hibernate.subclass
* table="ContactInfo"
*/
public class ContactInfoType extends com.poc.base.Persistent
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field personName
*/
private com.poc.PersonName personName;
/**
* Field contactMethod
*/
private com.poc.ContactMethod contactMethod;
//----------------/
//- Constructors -/
//----------------/
public ContactInfoType() {
super();
} //-- com.poc.ContactInfoType()
//-----------/
//- Methods -/
//-----------/
/**
* Note: hashCode() has not been overriden
*
* @param obj
*/
public boolean equals(java.lang.Object obj)
{
if ( this == obj )
return true;
if (super.equals(obj)==false)
return false;
if (obj instanceof ContactInfoType) {
ContactInfoType temp = (ContactInfoType)obj;
if (this.personName != null) {
if (temp.personName == null) return false;
else if (!(this.personName.equals(temp.personName)))
return false;
}
else if (temp.personName != null)
return false;
if (this.contactMethod != null) {
if (temp.contactMethod == null) return false;
else if (!(this.contactMethod.equals(temp.contactMethod)))
return false;
}
else if (temp.contactMethod != null)
return false;
return true;
}
return false;
} //-- boolean equals(java.lang.Object)
/**
* Method getContactMethod
*
* @hibernate.property
* column="contactMethod"
*/
public com.poc.ContactMethod getContactMethod()
{
return this.contactMethod;
} //-- com.poc.ContactMethod getContactMethod()
/**
* Method getPersonName
*
* @hibernate.property
* column="personName"
*/
public com.poc.PersonName getPersonName()
{
return this.personName;
} //-- com.poc.PersonName getPersonName()
/**
* Method isValid
*/
public boolean isValid()
{
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
} //-- boolean isValid()
/**
* Method marshal
*
* @param out
*/
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, out);
} //-- void marshal(java.io.Writer)
/**
* Method marshal
*
* @param handler
*/
public void marshal(org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, handler);
} //-- void marshal(org.xml.sax.ContentHandler)
/**
* Sets the value of field 'contactMethod'.
*
* @param contactMethod the value of field 'contactMethod'.
*/
public void setContactMethod(com.poc.ContactMethod contactMethod)
{
this.contactMethod = contactMethod;
} //-- void setContactMethod(com.poc.ContactMethod)
/**
* Sets the value of field 'personName'.
*
* @param personName the value of field 'personName'.
*/
public void setPersonName(com.poc.PersonName personName)
{
this.personName = personName;
} //-- void setPersonName(com.poc.PersonName)
/**
* Method unmarshal
*
* @param reader
*/
public static java.lang.Object unmarshal(java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
return (com.poc.ContactInfoType) Unmarshaller.unmarshal(com.poc.ContactInfoType.class, reader);
} //-- java.lang.Object unmarshal(java.io.Reader)
/**
* Method validate
*/
public void validate()
throws org.exolab.castor.xml.ValidationException
{
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
} //-- void validate()
}
|