I ran up against this once before and I don't remember exactly why. I
think it was a problem trying to port my data from MySQL to Oracle.
Anyways what I did and have kept around is extend the MySQL dialect
and then register this "fixed" copy. Its real easy.
public class MySQL5InnoDBDialectBitFixed extends MySQL5InnoDBDialect {
public MySQL5InnoDBDialectBitFixed() {
super();
registerColumnType(Types.BIT, "tinyint(1)");
}
}
You register the Dialect in your pom.xml in the jdbc settings:
<
hibernate
.dialect>com.jmh.foundation.service.MySQL5InnoDBDialectBitFixed</
hibernate.dialect>
-D
On Dec 22, 2008, at 5:34 PM, Jason Thrasher wrote:
Hi Matthias,
I was seeing this: my booleans were "bit(1)" values and impossible to
understand using either command-line mysql, or the gui query
browser. My
platform is OSX, MySQL 5.0.56-std, using hibernate.
The application worked fine, but it was difficult to see what was
going on
at a low-level. So, I explicitly set the data type for by boolean
columns
to varchar(1) as:
use char for boolean value:
@Column(name = "account_enabled", nullable = false,
columnDefinition =
"varchar(1)")
private boolean enabled;
while this uses a MySQL bit value:
@Column(name = "is_validated", nullable = false)
private boolean validated = false;
I also have this hibernateProperties line:
hibernate.query.substitutions=true 'Y', false 'N'
I'm not sure why this would affect your authentication, unless the
default
data was incorrect to start with.
Hope it helps,
Jason
Matthias Richter-3 wrote:
Hi,
I ran into following issue. When trying the Appfuse tutorials using
JPA, I
could not log in with the standard username / password combination.
Looking
into the database (mysql 5) revealed that in the app_user table the
fields
account_expired, account_locked and credentials_expired have the
datatype
bit. It seems that a JPA-annotated boolean does not lead to valid
mysql5-bit
values. Does anybody have an idea how to solve it? See
http://www.mindbug.org/2008/03/type-conversion-with-jpa.html for
further
information.
Cheers
Matthias
--
View this message in context:
http://www.nabble.com/Missing-JPA-Type-Conversion-tp21069932s2369p21138167.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net