basically I have parent clas called AccurateDate:
public class AccurateDate implements Serializable, Cloneable {
private Timestamp timestamp;
private int nanoseconds = -1;
{some more code here...}
protected void setTimestamp(Timestamp timestamp) {
if (timestamp != null) {
this.timestamp = (Timestamp) timestamp.clone();
updateTimestampNanos();
}
else
{
this.timestamp = null;
}
}
protected Timestamp getTimestamp() {
Timestamp returnedTimestamp = this.getDate();
if (!DBMS_SUPPORTS_MILLISECONDS) {
returnedTimestamp.setNanos(0);
}
return returnedTimestamp;
}
{similar accessor for the nanosec which is proetcted}
Then I have another class which is a subclass of this and this is what I'm trying to persist, here is the code:
public class PartialDate extends AccurateDate implements Serializable, Cloneable {
private PrecisionCode precision;
protected char getPrecisionChar() {
return precision.getPrecision();
}
protected void setPrecisionChar(char precision) {
this.precision = PrecisionCode.valueOf(precision);
}
}
here is my mapping for this: -- the partial date will be a component for a persistable class
<component name="dateOfBirth" class="com.orchestral.index.common.data.date.PartialDate">
<property name="timestamp" column="dateOfBirth" />
<property name="precisionChar" column="dateOfBirthPrecision" />
<property name="nanoseconds" column="dateOfBirthNanoseconds" />
</component>
The problem that I'm having is everytime I try to persist this class, Hibernate throws an exception that says it couldn't find the property called timestamp.
If I try to change the accessor methods to public, then it works without any problems -- so i guess my question is I thought hibernate supports public, protected or even private accessor methods?
|