-->
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.  [ 6 posts ] 
Author Message
 Post subject: CLOB problems when using table per class inheritance
PostPosted: Wed Feb 28, 2007 7:51 am 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi,
I have an inheritance hierarchy, one entity in the hierarchy contains a CLOB field. I am using table per concrete class..

The SQL generated for this is of the form

SELECT Person.A, PersonB, Person.CLOBFIELD FROM {
SELECT Person.A, Person.B, null as CLOBFIELD from PERSON TPERSON
null as
UNION
SELECT Person.A, Person.B, Person.CLOBFIELD from PERSON TEMPLOYEE}

In SQLServer, this gives the exception:
com.microsoft.sqlserver.jdbc.SQLServerException: The text data type cannot be selected as DISTINCT because it is not comparable.

The UNION keyword cannot be used for queries including a CLOB.
Does anybody have a work around for this?
Note I am forced to use table per class as I have to integrate with an existing database,
Cheers


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 3:09 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
And you need to have an association to this superclass?
If not, you can simply map the superclass as @MappedSuperclass

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 5:18 am 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
emmanuel wrote:
And you need to have an association to this superclass?
If not, you can simply map the superclass as @MappedSuperclass


I need associations to both classes. Does this mean hibernate cannot handle the CLOB? It could if the UNION could be change to UNION ALL.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 12:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
OK I had a chat with Steve
You can change or subclass the SQLServer dialect to return true on supportsUnionAll()
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2478

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 10:59 am 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi,
Thanks for that.
I got it to work by extending SQLServer.
I was just wondering is there anyway I change the behaviour of SQLServer without extending it i.e. can I get a handle to it at runtime and just set this union all behaviour.
Kind Regards


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 11, 2007 8:02 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
nope, but we will change the default SQLDialect in the near future

_________________
Emmanuel


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