Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

hibernate userType

Posted on 2011-09-10
2
302 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

808 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