Apologise if this is far too simple, but I just don't seem to be able to achieve the following:
Hibernate version: 2.1.2
Name and version of the database you are using: MySQL 4.0.21
I have a "Message" class that contains the following variable with its getter method:
Code:
private int generator = 0 ;
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*
* [b]@hibernate.property not-null="true"[/b]
*/
public int getGenerator() {
return generator;
}
What I'm trying to get is the "generator" field to be persisted and I'd like it to be created with a default value of 0.
Theoretically, setting not-null=true with the XDoclet declaration should make the field exactly that (NOT NULL), but I just can't see how I can set the default value.
Anyway, the database is created just fine, but the problem is that rather than setting the column as:
Code:
generator int[11] NOT NULL default '0'
what I get is (look like the not-null="true" is being ignored):
Code:
generator int[11] default NULL
I've been looking everywhere I know for an answer, but no luck....
Any ideas?
Thanks in advance