Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Hibernate.custom has been removed in 3.6. What replaced it?
PostPosted: Thu Jan 26, 2017 10:02 am 
Newbie

Joined: Wed Jan 18, 2017 8:37 pm
Posts: 3
I've upgraded to Hibernate 3.6.10 and Hibernate.custom has been removed, what replaced it?

I'm using an inhouse-written Hibernate custom UserType with query.addScalar calls.

Code:
query.addScalar("trancode", Hibernate.custom(OracleCharType.class));


Top
 Profile  
 
 Post subject: Re: Hibernate.custom has been depreciated, what replaced it?
PostPosted: Thu Jan 26, 2017 11:23 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1228
That's a very old Hibernate version that we no longer support.

I don't think there's any substitute for that. In fact, there is a good chance that UserType is going to be removed completely in Hibernate 6, so that you need to use generic Types instead.

Check out this article for how you can use SqlTypeDescriptor and JavaTypeDescriptor to build a custom Type. The article was written for Hibernate 5, so you'll have to adapt it for 3.6 accordingly.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Hibernate.custom has been removed in 3.6. What replaced it?
PostPosted: Thu Jan 26, 2017 11:45 am 
Newbie

Joined: Thu Dec 16, 2010 4:09 pm
Posts: 4
If you're stuck on 3.6 then you want org.hibernate.usertype.UserType now. Although I agree with vlad that it would be better if you can upgrade and use newer solutions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

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.