max wrote:
what is the signature of your cancellable property ?
your returnedclass is saying it should take and return a Boolean - maybe yours are a boolean ?
I don't think I've really got the hang of these user types yet. ;-) In my CurrencyDAO.hbm.xml file, I've got a property declared as so:
Code:
<property name="cancelled" column="CCCYCF" not-null="true" type="uk.co.trisystems.morph.user_type.BooleanCBlankType">
<meta attribute="field-description">Currency Cancelled</meta>
</property>
CurrencyDAO.java is generated for me by hbm2java. I've not touched the code by hand at all. Its cancelled property is an instance of BooleanCBlankType, not boolean
or Boolean. (Is this as it should be, or have I declared the property incorrectly in my hbm.xml file?) Here it is:
Code:
/** persistent field */
private BooleanCBlankType cancelled;
/**
* Currency Cancelled
*/
public BooleanCBlankType getCancelled() {
return this.cancelled;
}
public void setCancelled(BooleanCBlankType cancelled) {
this.cancelled = cancelled;
}
The BooleanCBlankType.java class that I've written returns Boolean.class from its returnedClass() method, and int[] typeList = {Types.CHAR} from its sqlTypes() method, indicating (I think) that the column on the database side is a CHAR field (and that only one column is involved), and that the java side value is a Boolean.
My nullSafeGet and nullSafeSet methods are responsible for performing the conversions. But I don't think that the problem lies with them, since they don't turn up in the traceback. Or is this an unwarrented assumption?
The problem that I can see is that in net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(), it's trying to call the CurrencyDAO.setCancelled() method with a Boolean, but it wants a BooleanCBlankType instead. So, either the CurrencyDAO.cancelled property ought to be a Boolean, or CurrencyDAO.setCancelled() should be passed a BooleanCBlankType. I am new to Hibernate, and I don't know which of these is the case.
I
suspect that the problem lies in my CurrencyDAO.hbm.xml file somewhere, rather than in my UserType code, but I'm far from sure. ;-)
Your help is very much appreciated, Max.