3point wrote:
take a look at
http://opensource2.atlassian.com/projec ... se/HHH-468 for a discussion of the subject.
The thread is geared towards those using hbm files, so if you are using annotations, you can use the @Column annotation with the
"columnDefinition" attribute set to "BOOLEAN" to get around this. The newer MySQL JDBC driver then silently converts this to tinyint(1) for you and you are back to the behavior as under MySQL 4.x
For example:
Code:
@Column(columnDefinition="BOOLEAN")
public java.lang.Boolean getDisabled() {
return disabled;
}
I've tested this with MySQL ConnectorJ 3.1.12 and MySQL 5.0.18 and my DDL generates correctly (i.e. tinyint(1) is back)
Bit(1) is better than TINYINT for boolean type. The table schema is generated using Bit(1). I do not understand why it complains too long when inserting records.
I have many entities, and lots of Boolean type columns. Using columnDefinition is not a good idea because it is not portable.
Hibernate should have a nicer way to solve this. Has Hibernate tested on MySQL 5.0.18?
Thanks!