The database has a VARCHAR(1) field that may be Y or N, and I want to have it mapped as a Boolean in the entity class.
hibernate.reveng.xml has this:
Code:
<table name="MY_TABLE">
<column name="FLAG"
type="com.company.lib.hibernate.usertypes.YNBooleanType"/>
YNBooleanType inherits from org.hibernate.type.BooleanType, so its getReturnedClass() function already does the right thing and returns Boolean.class.
However, the generated Pojo has
Code:
@Column (name = "FLAG", nullable = false, length = 1)
public YNBooleanType getFlag () {
return this.flag;
}
Now I knew that the standard reason for this is that the user type isn't on the classpath.
So I placed YNBooleanType in a jar file that I specifically added to the classpath. This didn't change anything.
In fact I think the class isn't loaded, I had added
Code:
static {
System.err.println ("YNBooleanType was loaded");
}
to the class body, but the message never turned up (I do get "didn't report any primary key columns" message, so I'm pretty sure I'm looking at the right console).
Somehow it's ignoring the specified classpath.
I'm using the Classpath tab on the Hibernate Configuration from the Hibernate view.
Maybe that's the wrong classpath setting?
I'd like to make it log the classpath it's using to resolve user types - is there a way to raise the logging level when it's running inside Eclipse?