Solved

hibernate userType

Posted on 2011-09-10
2
297 Views
Last Modified: 2012-05-12
I would like to know about hibernate userType. Why, how, where we use it. Advantages, disadvantages of using it. I am not clear on this concept. Thanks in advance
0
Comment
Question by:gudii9
  • 2
2 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36518138

UserType provides the ability to persist properties which
are not of simple type (like String, int) in the most convenient way of your chioosing

In the beginning of this article they explain how to provide
the prsistnce of StringBuilder in the form of the String rather than serialization of the object:
http://blog.xebia.com/2009/11/understanding-and-writing-hibernate-user-types/

It is a rather lengthy article, but if your goal is to understand what is a UserType interface
rather than to understand the details of what to do with StringBuilder, it is enough to read
more or less the first page.

This is also a useful summary of the UserType usage in this
set of slides about Hibernate:

http://javamug.org/mainpages/presentations/Hibernate-1x2.pdf
6. UserType
¿ Can provide your own serialization and
deserialization mechanisms for properties
1.Implement the UserType interface
2.Specify the property type in the mapping using
type="classname"
3.Alternatively can create alias for classname with
<typedef>

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36518146
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now