BUG #14712: postgres how to handle boolean datatype to use 0 and 1 using hibernate

Lists: pgsql-bugs
From: aprasad(at)flexerasoftware(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14712: postgres how to handle boolean datatype to use 0 and 1 using hibernate
Date: 2017-06-19 07:09:20
Message-ID: 20170619070920.1551.7081@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14712
Logged by: Akanksha Prasad
Email address: aprasad(at)flexerasoftware(dot)com
PostgreSQL version: 9.6.2
Operating system: windows 7
Description:

I wanted to use boolean withd efault value as 1 in hbm file , the hibernate
generates the ddl for sql server and oracle and they both works fine but
postgres fails with error as cannot have int default 1 as value for boolean
field.
Please help with this. How can i do this with changes only at the dialect
level beacuse changing the application me too many changes and that too sql
server and oracle databases with fail.


From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: aprasad(at)flexerasoftware(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14712: postgres how to handle boolean datatype to use 0 and 1 using hibernate
Date: 2017-06-19 15:01:12
Message-ID: CAKFQuwbn38OXfnz0pUH=aYsQ--tcrb0jU+VQ3gawyYZzvbKLrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, Jun 19, 2017 at 12:09 AM, <aprasad(at)flexerasoftware(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14712
> Logged by: Akanksha Prasad
> Email address: aprasad(at)flexerasoftware(dot)com
> PostgreSQL version: 9.6.2
> Operating system: windows 7
> Description:
>
> I wanted to use boolean withd efault value as 1 in hbm file , the hibernate
> generates the ddl for sql server and oracle and they both works fine but
> postgres fails with error as cannot have int default 1 as value for boolean
> field.
> Please help with this. How can i do this with changes only at the dialect
> level beacuse changing the application me too many changes and that too sql
> server and oracle databases with fail.
>

​Please send non-bug-report questions to pgsql-general(at)postgresql(dot)org or a
more appropriate list if there is one.

Thank You.

David J.

p.s. It sounds to me, though, that if Hibernate is translating between
dialects that you should be able to specify "default true" for your boolean
column and let it make that work with the other DBMSes - a true boolean
column only stores "True" and "False" by definition.