Oracle10g Grails 1.3.7 GORM与Oracle 10g DB reults的集成;SQL错误:932,SQLState:42000“;用于将域类属性映射到Orable CLOB类型

Oracle10g Grails 1.3.7 GORM与Oracle 10g DB reults的集成;SQL错误:932,SQLState:42000“;用于将域类属性映射到Orable CLOB类型,oracle10g,gorm,clob,Oracle10g,Gorm,Clob,我完全了解以下内容中描述的问题: 当服务类调用doamin类上的save()时,就会出现此问题。doamin类的属性(“String contentText”)设置将作为CLOB数据类型持久保存在Oracle 10g数据库中(选择CLOB是因为我希望存储长度超过4000个字符的文本,Varchar2不支持4000多个字符) (我试图存储的文本内容是HTML代码) 我的问题是:如何使用Grails1.3.7中的GORM在Oracle 10g DB中的CLOB类型字段中存储文本内容(如HTML代码)

我完全了解以下内容中描述的问题:

当服务类调用doamin类上的save()时,就会出现此问题。doamin类的属性(“String contentText”)设置将作为CLOB数据类型持久保存在Oracle 10g数据库中(选择CLOB是因为我希望存储长度超过4000个字符的文本,Varchar2不支持4000多个字符)

(我试图存储的文本内容是HTML代码)

我的问题是:如何使用Grails1.3.7中的GORM在Oracle 10g DB中的CLOB类型字段中存储文本内容(如HTML代码)

非常感谢你帮了我的忙! /赫尔曼

日志摘录:

2011-12-14 15:06:53,564 DEBUG JDBCExceptionReporter:92 - could not execute query [select this_.id as id4_0_, this_.version as version4_0_, this_.activation_price as activation3_4_0_, this_.active as active4_0_, this_.content_text as content5_4_0_, this_.country_code as country6_4_0_, this_.customer_type as customer7_4_0_, this_.danish_db_id as danish8_4_0_, this_.data_cap_type as data9_4_0_, this_.expiry_date as expiry10_4_0_, this_.group_name as group11_4_0_, this_.is_minimum_commitment as is12_4_0_, this_.is_pott as is13_4_0_, this_.launch_date as launch14_4_0_, this_.main_image as main15_4_0_, this_.monthly_price as monthly16_4_0_, this_.name as name4_0_, this_.pdf as pdf4_0_, this_.product_id as product19_4_0_, this_.time_of_notice as time20_4_0_, this_.type as type4_0_, this_.usp1 as usp22_4_0_, this_.usp2 as usp23_4_0_, this_.usp3 as usp24_4_0_, this_.version_comment as version25_4_0_ from price_plan this_ where (this_.activation_price=? and this_.active=? and this_.content_text=? and lower(this_.country_code)=? and lower(this_.customer_type)=? and this_.danish_db_id=? and lower(this_.expiry_date)=? and lower(this_.group_name)=? and this_.is_minimum_commitment=? and this_.is_pott=? and lower(this_.launch_date)=? and this_.monthly_price=? and lower(this_.name)=? and lower(this_.product_id)=? and this_.time_of_notice=? and lower(this_.type)=?)]
java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CLOB
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
    ... 
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
2011-12-14 15:06:53,589  WARN JDBCExceptionReporter:100 - SQL Error: 932, SQLState: 42000
2011-12-14 15:06:53,592 ERROR JDBCExceptionReporter:101 - ORA-00932: inconsistent datatypes: expected - got CLOB

必须将列映射到正确的类型,如下所示:

class Address {
   String number
   String postCode
   static mapping = {
      postCode type:'text'
   }
}
这将使邮政编码列映射到SQL文本或CLOB类型,具体取决于所使用的数据库


来源:

您必须将列映射到正确的类型,如下所示:

class Address {
   String number
   String postCode
   static mapping = {
      postCode type:'text'
   }
}
这将使邮政编码列映射到SQL文本或CLOB类型,具体取决于所使用的数据库

资料来源: