How to create a BOOLEAN column in MySql using Eclipselink


Problem :

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?



Solution :

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.


Mysql Tutorials

Mysql Howto..

How to get ORDERED and limited rows form MySQL and randomize show order

How to dynamically accumulate checkbox values in a SQL query

MySQL: how to store height/weight information?

How to create and structure a Virtual Credits System using PHP/MySQL

How to convert a string to variable through a loop and save it in MySQL Database

How to merge results of two mysql tables in one output

mysql - how to get number of unique active users per month who posted or commented?

Mysql: How to aggregate data into days based on half hourly timestamps?

MySQL: How to update colum1 if value does not exists in column 2

How to install socket.io and mysql on Node.js

how to output the same MYSQL column twice as JSON

how to check the duplicate key in mysql dbi Perl?

How to keep your hibernate levell 1 cache consistent through external updates?

How to explicitly sort by the default sort order in MySQL?

How to get Data Between Two Dates in mysql?

How to determine field-type for SOLR indexing?

How to recover/Change MySQL Password

MySQL considers 'е' and 'ё' equal, how do I set it to consider them different?

How to get affected rows in previous MySQL operation?

How to set a variable as query result in a MySQL stored procudure?

how to explode mysql table data in php

In MySQL, how to run sql in the command line?

How to use Bit flags in mysql

How to return results that relate across 3 tables efficiently MySQL

How do I add a reference to the MySQL connector for .NET?

I am using mysql stored-procedure.My SP return dataset ,how to bind the value into crystal report

How to populate html combo box with mysql data

Migrating from Oracle to MySQL. VARCHAR2 length defined using bytes. How to port?

How to substring a MySQL table column

how to get id in mysql