-->
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.  [ 2 posts ] 
Author Message
 Post subject: composite-element and sql server
PostPosted: Fri Sep 07, 2007 10:07 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
Hibernate version:
3.x

Mapping documents:
Code:
<set name="foo" table="foo" order-by="name">
    <key column="parent_id" />
    <composite-element class="Bar">
        <property access="field" name="name" />
        <property access="field" name="surname" />
        <property access="field" name="story" type="text" />
    </composite-element>
</set>


Full stack trace of any exception that occurs:
Code:
org.hibernate.exception.GenericJDBCException: could not delete collection rows: [Bla#1]
...
Caused by: java.sql.SQLException: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.



Name and version of the database you are using:
SQL Server 2000


The generated SQL (show_sql=true):
Code:
delete from bla where parent_id=? and name=? and surname=? and story=?



Hello

I've got a class which has a Set of Bars. I store them as composite-elements, without an auto-incremented ID. As such, when trying to delete one of those Bars in the set, hibernate tries to match all fields to locate that row.

Bar has fields "name", "surname", "story". The last field, story, is of type text and, as shown in the exception, comparison cannot be achieved.

This works fine in MySQL. But what happens in SQL Server?
Can I signify in the mapping that I only want name and surname to be used for the equality in the generated sql statement?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 11, 2008 10:10 am 
Newbie

Joined: Fri Apr 06, 2007 1:54 am
Posts: 14
any ideas? is this problem solvable?

Documentation (8.2. Collections of dependent objects) states that "Hibernate has to use each columns value to identify a record when deleting objects (there is no separate primary key column in the composite element table)".


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