I originally posted this as a question about UserType but discovered that the error appears to be in an EclipsePlugin from MyEclipse. Following the Oreilly book
Hibernate: A Developer's Notebook by Elliott I am generating a user type. Let's say for this example I want to persist Color as ColorType. Let's say that the object I'm persisting is Chair and my Chair.hbm.xml file has the following in it:
Code:
<property name="chairColor" type="doowop.ColorType">
<meta attribute="field-description">Color of the chair</meta>
<meta attribute="use-in-tostring">true</meta>
</property>
My typesafe enumeration class for Color has the following:
Code:
public class Color implements Serializable {
...
public static final Color RED = new Color("red", "Deep Red");
public static final Color BLUE = new Color("blue", "Navy Blue");
...
}
GeneratePOJO generates a constructor for Chair with the following signature:
Code:
public Chair (..., ColorType colorType, ...) { ... }
which should be:
Code:
public Chair (..., Color color, ...) { ... }
I want to create an instance of chair so I do something like:
Code:
Chair mychair = new Chair( ..., Color.RED, ...)
which obviously fails because Chair expects a ColorType, not a Color object. I'm leaving this post here for anyone interested in using this extremely useful feature.