-->
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: text-clob not loading
PostPosted: Tue Mar 01, 2005 11:20 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 8:12 pm
Posts: 35
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hello all:
I have just finished upgrading to Hibernate 3.0 successfully, however; whenI run my application the primary key is set for the field "comment" of type "text" (which is defined as Clob in query). If I run the application using hibernate 2.1.8, the field is reterieved properly and is displayed corrently but with Hibernate 3.0 the field is set to primary key !!!



Hibernate version:3.0

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="iadm.readme.model">

<class name="iadm.readme.model.Comment" table="README.COMMENT" >

<id name="id" column="COMMENT_ID" type="long" >
<generator class="native"/>
</id>

<property name="author" type="string" column="AUTHOR" length="50" not-null="true"/>
<property name="title" type="string" column="TITLE" length="80" not-null="true"/>
<property name="comment" type="text" column="COMMENT" not-null="true"/>
<property name="visible" type="yes_no" column="VISIBLE" not-null="true"/>
<property name="created" column="CREATED_TIMESTAMP" type="timestamp" not-null="true" update="false"/>
<property name="modified" column="MODIFIED_TIMESTAMP" type="timestamp" not-null="true"/>

<many-to-one name="category" column="CATEGORY_ID" class="iadm.readme.model.Category" not-null="true" fetch="join"/>

<set name="releases" cascade="all-delete-orphan" inverse="true" batch-size="100" >
<key>
<column name="COMMENT_ID" not-null="true" />
</key>
<one-to-many class="iadm.readme.model.Release" />
</set>
</class>
<query name='comment'> <![CDATA[from Comment c left join fetch c.releases r where c.id = :id ]]></query>
<query name='commentByCategoryId'> <![CDATA[from Comment c left join fetch c.releases r left join fetch c.category where c.category.id = :id]]></query>
<query name='visibleCommentByCategoryId'> <![CDATA[from Comment c left join fetch c.releases r left join fetch c.category where c.category.id = :id and c.visible = :visible1 and c.category.visible = :visible2 ]]></query>
</hibernate-mapping>


Function called:
public Collection getCommentsByVisibilityAndCategoryId(long categoryId,
boolean commentVisible, Session session) {
Collection result = null;
String visible = (commentVisible) ? "Y" : "N";
try {
Collection comments = session.getNamedQuery(
"visibleCommentByCategoryId").setLong("id", categoryId)
.setString("visible1", visible).setString("visible2", "Y")
.list();
result = new HashSet(comments);
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return result;
}


Name and version of the database you are using: DB2 8.2


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 02, 2005 5:02 am 
Beginner
Beginner

Joined: Wed Jul 21, 2004 8:12 pm
Posts: 35
I was wondering if anyone really knows why this is happening, If I save a large text using Hibernate 3.0 in the Clob filed, the value is stored properly ( I have checked the database), but for the retrival, the value is set to the value of the primary key. However; the same code works fine with Hibernate 2.1.8, the actual text is retrieved.


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.