-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: UserType vs binary for storing binary data
PostPosted: Thu Aug 17, 2006 6:55 am 
Newbie

Joined: Tue Aug 08, 2006 8:05 am
Posts: 3
Location: Uppsala, Sweden
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.