-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 5 substitute for Spring ClobStringType
PostPosted: Wed Jun 22, 2016 2:12 pm 
Newbie

Joined: Wed Jun 22, 2016 1:37 pm
Posts: 4
Hi,

Spring ClobStringType is deprecated in favour of Hibernate 4/5.

What would be a substitute for hbm.xml style mapping this:
Code:
<property name=”summary” type=”org.springframework.orm.hibernate3.support.ClobStringType”/>

Code:
public class Book
{
    private String summary;
    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }
}

Wit Hibernate 5 and Spring 4 - am I able to still have String summary property in my java class?


Top
 Profile  
 
 Post subject: Re: Hibernate5 substitute for Spring ClobStringType
PostPosted: Thu Jun 23, 2016 2:52 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
You can use the @Lob annotation:

Code:
@Lob
private String warranty;


I don't think there is an equivalent for HBM, but you can mix HBM and annotations, so there shouldn't be any problem.

_________________
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 5 substitute for Spring ClobStringType
PostPosted: Thu Jun 23, 2016 8:50 am 
Newbie

Joined: Wed Jun 22, 2016 1:37 pm
Posts: 4
Is there any adapter - way for this? Like creating custom type or adapter... to have hmb working?


Top
 Profile  
 
 Post subject: Re: Hibernate 5 substitute for Spring ClobStringType
PostPosted: Thu Jun 23, 2016 9:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
I am not aware of any such adapter.

But even if it were, it's still much simpler to use a single annotation, right?
You can retain all the HBM mappings, you just have to remove the summary property definition from HBM and annotate the summary property with @Lob on the entity class.

HBM are considered deprecated, so if you plan on migrating to Hibernate 5, you should migrate to annotations as well.
If you check the Hibernate 5 deprecation list, it's stated that:

Quote:
hbm.xml is a legacy mapping format now considered deprecated.

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.