How do you store a Java Boolean type variable in a PostgreSQL table with corresponding column data type defined as "bit"? -


now, data type of variable in java class "boolean". want store in postgresql table. column in want store data has data type defined "bit". when try save object has boolean variable, error:

error: column "isdeleted" of type bit expression of type boolean 

i'm using hibernate store data. code snippet defining , mapping variable:

@column(name = "isdeleted") private boolean isdeleted; 

how save object? thank you!

please use proper boolean type in postgres. although possible store boolean values in bit streams, makes later usage complicated.

with usual boolean can this:

select * table isdeleted; 

whereas bit type have bitwise operations:

select * table isdeleted > b'0' 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -