Hi,
BASIC_TYPES are simpler to use than UserTypes because they can be guessed when you set a parameter of this type. They are also easier to use in the mapping files because they have a short name (with UserTypes you have to provide the full class name).
I want to have your opinion about a feature request relative to this.
It would be great to be able to add new BASIC_TYPES at startup. The simpler way is through the hibernate.cfg.xml file. It could be something like
Code:
<UserType name="oid" class="com.xyz.Oid" type="com.xyz.hibernate.OidType"/>
Then in the mapping files you can use your user type like this
Code:
<id name="id" type="oid">
<generator class="assigned"/>
</id>
But the major advantage of this is that you can use setParameter(int, Object) with this type without the need to provide the type at runtime. The guesstype method can retrieve the type associated with the Oid class.
It seems to be a useful feature that can be quite simple to implement.
Any comments appreciated
Seb