du-it
du-it

Reputation: 3009

How to create a BOOLEAN column in MySql using Eclipselink

In my @Entity class I have defined a boolean property named reservable:

    @Column(name="reservable", columnDefinition = "boolean default true")
    private boolean reservable;

It is always a column of type TINYINT(1) with default value 1 created. How can I tell Eclipselink to generate a table column of type BOOLEAN in MySql?

Upvotes: 2

Views: 3079

Answers (1)

wdick
wdick

Reputation: 99

MySQL (5.x) doesn't know about a BOOLEAN type.

See for example http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html

Quote:

BOOL, BOOLEAN

These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true.

Upvotes: 4

Related Questions