Any changes in Java and PGSQL 9.4?

Started by Bjørn T Johansenabout 11 years ago4 messagesgeneral
Jump to latest
#1Bjørn T Johansen
btj@havleik.no

Just noticed that a column field of type bigint containing a null, becomes a 0 when retrieving it from the resultset using JDBC.
If I run the same application against my old 9.3 database, the value retrieved is a null....

Regards,

BTJ

--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen

btj@havleik.no
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Thomas Kellerer
spam_eater@gmx.net
In reply to: Bjørn T Johansen (#1)
Re: Any changes in Java and PGSQL 9.4?

Bjørn T Johansen wrote on 18.01.2015 20:20:

Just noticed that a column field of type bigint containing a null, becomes a 0 when retrieving it from the resultset using JDBC.
If I run the same application against my old 9.3 database, the value retrieved is a null....

You need to show us some code.

getInt() or getLong() can never return null because primitives can't be null in Java.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Bjørn T Johansen
btj@havleik.no
In reply to: Bjørn T Johansen (#1)
Re: Any changes in Java and PGSQL 9.4?

On Sun, 18 Jan 2015 20:20:35 +0100
Bjørn T Johansen <btj@havleik.no> wrote:

Just noticed that a column field of type bigint containing a null, becomes a 0 when retrieving it from the resultset using JDBC.
If I run the same application against my old 9.3 database, the value retrieved is a null....

Regards,

BTJ

Sorry, my fault... I tried running against my old database with my workaround to set the value to null.. Maybe it's a new Spring feature as am using
a newer version of Spring also....

BTJ

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Bjørn T Johansen
btj@havleik.no
In reply to: Thomas Kellerer (#2)
Re: Any changes in Java and PGSQL 9.4?

On Sun, 18 Jan 2015 20:25:48 +0100
Thomas Kellerer <spam_eater@gmx.net> wrote:

Bjørn T Johansen wrote on 18.01.2015 20:20:

Just noticed that a column field of type bigint containing a null, becomes a 0 when retrieving it from the resultset using JDBC.
If I run the same application against my old 9.3 database, the value retrieved is a null....

You need to show us some code.

getInt() or getLong() can never return null because primitives can't be null in Java.

Yes, you are absolutely correct.. I was fooled by the capital L in getLong but I see that it returns long..
I guess I just hadn't triggered this problem before...

BTJ

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general