Does the CUBRID db supports the Grails Hibernate function?
Hi
I am encountering big problem with the cubrid database and grails hibernate function. I have created the domain class and the mappings as follow.
class DEvent {
String city
String name
DUser organizer
String venue
Date startDate
Date endDate
String description
static hasMany = [volunteers:DUser, sponsorships:SponsorShip, tasks:Task, messages:Message]
String toString(){
"$name, $city"
}
static constraints = {
name()
city()
description(maxSize : 5000)
organizer()
venue()
startDate()
endDate()
volunteers(nullable : true)
sponsorships(nullable : true)
tasks(nullable : true)
messages(nullable : true)
}And my DUser domain class look like this:
class DUser {
String fullName
String userName
String password
String email
String website
String bio
String toString(){ fullName}
static constraints = {
fullName()
userName()
email()
website()
bio(maxSize:5000)
}
}When i try to run the grails application it prompted to a error message l
Caused by MappingException: No Dialect mapping for JDBC type: 12 ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread
Please if you have any one have the answer please let me know. Thank you very much.
"JDBC type: 12" is VARCHAR. It could not map VARCHAR(5000) with data types defined in the dialect.
On line 63 of CUBRIDDialect.java (the Hibernate dialect) you can notice that there is a character size limitation of 4000 chars. This is a default configuration of the dialect. For your case, a fallback data type has to be introduced for cases when the length is over 4000 chars.
If you can compile Hibernate yourself, you can add the following code on line 63 just before the original VARCHAR(4000) definition like:
registerColumnType( Types.VARCHAR, "string" ); registerColumnType( Types.VARCHAR, 4000, "varchar($l)" );
This will ensure that strings over 4000 characters get registered as STRING data type which is equivalent to VARCHAR(1,073,741,823), i.e. the maximum value.
I will also push the fix to Hibernate.