I just solved the problem of clob-text loading by getting around the problem. But this is caused by a bug in Hibernate 3.0.
Here is my original table definitions
CREATE TABLE README.COMMENT (COMMENT_ID BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
CATEGORY_ID BIGINT NOT NULL ,
AUTHOR VARCHAR (50)NOT NULL ,
TITLE VARCHAR(80) NOT NULL,
VISIBLE CHARACTER (1) NOT NULL,
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
MODIFIED_TIMESTAMP TIMESTAMP NOT NULL,
COMMENT CLOB NOT NULL,
PRIMARY KEY (COMMENT_ID),
CONSTRAINT CATEGORY FOREIGN KEY (CATEGORY_ID) REFERENCES README.CATEGORY (CATEGORY_ID)ON DELETE CASCADE ,
CONSTRAINT EXCLUDE_FLAG CHECK (VISIBLE in ('Y', 'N')) );
Note that the primary key field name is "COMMENT_ID" and I have a field of Clob whose name is "COMMENT". When I run my test case the
"COMMENT" field does not appear in the sql statement and its value is set to the primary. Hibernate can not distinguish between these two names because of their similarity.
Here is the sql statement I got :
select comment0_.COMMENT_ID as COMMENT1_0_, releases1_.RELEASE_ID as RELEASE1_1_, comment0_.AUTHOR as AUTHOR1_0_, comment0_.TITLE as TITLE1_0_,
comment0_.VISIBLE as VISIBLE1_0_, comment0_.CREATED_TIMESTAMP as CREATED6_1_0_, comment0_.MODIFIED_TIMESTAMP as MODIFIED7_1_0_,
comment0_.CATEGORY_ID as CATEGORY8_1_0_, releases1_.PLATFORM_ID as PLATFORM2_4_1_, releases1_.PRODUCT_ID as PRODUCT3_4_1_,
releases1_.COMMENT_ID as COMMENT4_4_1_, releases1_.COMMENT_ID as COMMENT4___, releases1_.RELEASE_ID as RELEASE1___
from README.COMMENT comment0_ left outer join README.RELEASE releases1_ on comment0_.COMMENT_ID=releases1_.COMMENT_ID where (comment0_.COMMENT_ID=?)
I changed the name "COMMENT" to "NOTE" in my table definition and mapping file and then everything worked and "NOTE" appeared in the sql statement . Here is the sql
select comment0_.COMMENT_ID as COMMENT1_0_, releases1_.RELEASE_ID as RELEASE1_1_, comment0_.AUTHOR as AUTHOR1_0_, comment0_.TITLE as TITLE1_0_, comment0_.NOTE as NOTE1_0_, comment0_.VISIBLE as VISIBLE1_0_, comment0_.CREATED_TIMESTAMP as CREATED6_1_0_, comment0_.MODIFIED_TIMESTAMP as MODIFIED7_1_0_, comment0_.CATEGORY_ID as CATEGORY8_1_0_, releases1_.PLATFORM_ID as PLATFORM2_4_1_, releases1_.PRODUCT_ID as PRODUCT3_4_1_, releases1_.COMMENT_ID as COMMENT4_4_1_, releases1_.COMMENT_ID as COMMENT4___, releases1_.RELEASE_ID as RELEASE1___ from README.COMMENT comment0_ left outer join README.RELEASE releases1_ on comment0_.COMMENT_ID=releases1_.COMMENT_ID where (comment0_.COMMENT_ID=?)
I changed back the name "NOTE" TO "COMMENT" , the same problem (just to be sure before I post this message)
regards,
|