I have extended the HibernateJavaTypeMapper
(middlegen.plugins.hibernate) to map my own user
defined types as needed.
For example I am currently redirecting to my own
classes on string and java.math.BigDecimal and int.
However, when you execute the MiddleGen program and
look at any of the fields that I have redirected the
drop down for the field type defaults to boolean since
apparently Middlegen does not know how to display or
use my user defined type. However, if you look at the
out put file (if the user does not selected in the
field) then the output for my type is correct.
I orginally posted the following at the Hibernate Tools
forum.
http://forum.hibernate.org/viewtopic.php?p=2226311#2226311
"I have created my own custom hibernate UserTypes for
our Legacy database and application.
I have also extended the HibernateJavaTypeMapper (from
middlegen.plugins.hibernate.HibernateJavaTypeMapper) to
have the getPreferredJavaType return my own UserType if
a string or int is returned by super
(HibernateJavaTypeMapper).
This works great and as expected.
However when I view the table in middlegen and look at
any columns that use my custom UserType the dropdown
list for the Java type Middlegen gets confused. Since
Middlegen does not know about the new UserType the
dropdown list defaults to boolean.
The generated hmb.xml files are correct in that they
have my user defined types in them.
Has anyone else done this?
Suggestions?
Thank you,
David"
Logged In: YES
user_id=582419
You are correct. There is currently no correlation between the
GUI and the default type mapper if the type is unknown to the
set of types available for the database column type. Have to
think about how to address this in a clean way. Maybe a type
injection method on the type mapper would do.