Hi!
I have recently tried to replace a mapping written by a former employee. The old version used a UserType for the binary property. The former employee claimed that this was a must be for storing binary data, according to what he had read in Hibernate documentation.
After reading the Hibernate 3 core reference documentation, I tried to simply replace the UserType with the "binary" Hibernate type. This seems to work fine, but I am a bit worried that I have missed something.
Is the talk about using UserType for binary data some old school stuff that is not valid anymore?
What would be the main benefits from using a UserType instead of the simple binary type mapping?
The types used in the databases are image (SQLServer), bytea (PostgreSQL) and blob (Oracle XE), respectively.
Hibernate version:
3.1
Mapping documents:
Old version
<hibernate-mapping>
<class
name="com.company.Data"
table="Data"
>
<id name="id" type="int" unsaved-value="0">
<generator class="native"/>
</id>
<version name="version"/>
<property name="content"
type="com.company.DataType"
/>
</class>
</hibernate-mapping>
New version
<hibernate-mapping>
<class
name="com.company.Data"
table="Data"
>
<id name="id" type="int" unsaved-value="0">
<generator class="native"/>
</id>
<version name="version"/>
<property name="content"
type="binary"
/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
SQLServer 2005, Oracle 10G XE, PostgreSQL 8.1
|