我正在尝试从oracle 11g数据库检索所有对象,但某些对象在属性中包含特殊值。
编码:
//Retrieve thoughts
def thoughts = Question.findAllByThoughtsNotInList(["-", "", null], params)
def totalThoughts = Question.countByThoughtsNotInList(["-", "", null])
属性
thoughts
必须为CLOB
,因为我只拥有CRUD数据的权限。我不能使用任何DDL语句。这样,我收到了
ORA-00932
错误。ORA-00932: inconsistent datatypes: expected - got CLOB
我的网域类别:
class Question {
String person
String thoughts
static constraints = {
thoughts nullable: true
}
static mapping = {
table "Question"
id name: "person"
person column: "person"
thoughts column: "thoughts_person"
version false
}
}
我该如何解决?
最佳答案
如果将thoughts
视为CLOB,则它在域类中应为type: "text"
。您可以共享Question
域类吗?为什么在动态查找器中添加params
?
像这样:
class Question {
String thoughts
static mapping = {
table "QUESTION"
id column: "QUESTION_ID"
thoughts column: "THOUGHTS", type: "text"
}
}