I am using Grails 1.2.1, JDK 1.6.18 and trial version of HXTT Access.
I have defined the following domain class
class User {
// Fields
String userName
String userId
String password
static constraints = {
}
}
When I run the application, with the configuration pointing to an empty Access database, the Grails "magic" creates an Access table called user, with fields for each class member, plus the id and version fields i.e.
id Number, Decimal, 20
version Number, Decimal
user_name Text
user_id Text
password Text
When you try to add a record via Grails everything collapses.
However, if you manually change the first field to autonumber, everything is OK.
id AutoNumber
I believe that this is probably because HXTT is generating Decimal when we need Long Integer.
I can't see this the Dialect file... am I missing something, or has anyone found a workaround?
Gordon
|
In HxttAccessDialect.java(which is at http://www.hxtt.com/hibernate.html>
you will find
registerColumnType( Types.BIGINT, "numeric(19,0)" ); // MS Access DON'T SUPPORT BIGINT
you can try
registerColumnType( Types.BIGINT, "int" ); // MS Access DON'T SUPPORT BIGINT
>However, if you manually change the first field to autonumber, everything is OK.
>id AutoNumber
HXTT Access supports "ID int auto_increment" syntax.
|
I have made the change you suggested, but am struggling to re-compile the class... error message is "Cannot access org.hibernate.dialect.dialect".
My directory structure is
src/com/hxtt/support/hibernate/*.java
hibernate3.jar is in the CLASSPATH
Error occurs when I sit in src directory and say
javac 'com/hxtt/support/hibernate/HxttAccessDialect.java'
Could you suggest what I am doing wrong, or compile a replacement class file for me please?
I know that you suggest "int", but in Access the id fields are "long"... perhaps this would work better?
Regards,
Gordon
|
>Could you suggest what I am doing wrong, or compile a replacement class file
>for me please?
Now you download http://www.hxtt.com/test/hibernate.jar or http://www.hxtt.com/test/hibernate.zip
>I know that you suggest "int", but in Access the id fields are "long"...
>perhaps this would work better?
Yeah. MS Access' long type is int type in fact. Changed according to your suggestion.
|
Thank you for the updated hibernate.zip
I have used this and it works perfectly! I can create a Groovy class within Grails, compile it and run against an empty MS Access database... and it all appears to work in the same way as if I run the code against an empty MySQL database.
I would like to say a big thank you for the excellent support that you have provided so far. I still have more testing to do, but things are looking good so far!
Just to clarify, is the change of BigInt to Int a permanent change in your code, or just a special version for me, please?
Gordon
|
>is the change of BigInt to Int a permanent change in your code
Permanent change.
|