-->
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: i have a clob column , but how can i search it?
PostPosted: Thu Feb 05, 2004 3:37 am 
Beginner
Beginner

Joined: Sat Nov 01, 2003 6:14 am
Posts: 30
just like string column : where a like '%something%'

or anyone has other solutions?

thanks for your reply!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 4:18 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Depends on the database, in most, you can't. LOBs suck.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 3:27 pm 
Regular
Regular

Joined: Tue Sep 28, 2004 5:18 pm
Posts: 55
Location: Switzerland
I'd also like to query a Clob field. Other than this short thread, I haven't found much info. Would it be correct to sum up this issue as "You can't..."?

Of course, it's possible using native SQL in the FirstSQL OO database I'm using, via the Clob's toString() method, but this doesn't apply to HQL.

I could alway use Session.createSQLQuery(), but then I have to write a lot of glue code to actually construct my return objects, so I'm posting this in case someone knows a better alternative.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 3:41 pm 
Regular
Regular

Joined: Tue Sep 28, 2004 5:18 pm
Posts: 55
Location: Switzerland
cakewalk. Hibernate team got dis one covuhed.

Here's a native SQL clob query that gets mapped automatically to the right persistent object.
------------------------------------------------

Code:
public Library selectByTitle(String title) throws DAOException {
        String str = "select {lib.*} from Library lib where lib.title.compareTo(CAST( :title AS CLOB)) = 0";
        SyncQuery query = HibernateUtil.getSession().createSQLQuery(str, "lib", Library.class);
        query.setParameter("title", title);
        return (Library) query.uniqueResult();
    }


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.