Re: AW: [enhydra] How set null value to integer or long DB field in DODS
Steve Riley <[email protected]> Fri, 05 Aug 2005 12:06:27 -0500
| Newsgroups | gmane.comp.java.enhydra.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1123261625-26505-157
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
That's not quite true. The following code will set specific BigInt
fields to NULL. It's a workaround.
DBConnection dbc =3D Enhydra.getDatabaseManager().allocateConnection();
dbc.setAutoCommit(false);
// For bid or salesorder, need some integer fields to be null
PreparedStatement ps2 =3D ((EstimateDO)eiDO).getInsertStatement(dbc);
if (order.isBid())
ps2.setNull(3,Types.BIGINT); //salesordid
else
ps2.setNull(2,Types.BIGINT); //bidid
ps2.executeUpdate();
...
dbc.commit()
On Fri, 2005-08-05 at 18:11 +0200, Madl Alfred - Together AT wrote:
> Hi !
>=20
> This is a rather old DODS issue. You simply can not set datatypes to
> NULL that are mapped to Java primitive types...I think we should address
> this issue in one of the next DODS releases...
>=20
> Greetings.
>=20
> Alfred
>=20
> -----Urspr=C3=BCngliche Nachricht-----
> Von: Daniel Guryca [mailto:[email protected]]=20
> Bereitgestellt: Freitag, 05. August 2005 13:56
> Bereitgestellt in: Enhydra
> Unterhaltung: [enhydra] How set null value to integer or long DB field
> in DODS
> Betreff: [enhydra] How set null value to integer or long DB field in
> DODS
>=20
>=20
> I have a problem with setting DB field which is of type INTEGER or
> BIGINT.
>=20
> It is imposible to set this field with DO object to null value. (0 is=20
> saved instead of null) - because it accepts java int (long) types only.
> It is also imposible to get null value from this field. (0 is return) -=
=20
> because it gets java int (long) types only.
>=20
> So is there a way how to set or get a value of null for DB fields of=20
> type INTEGER or BIGINT?
>=20
> Thank you for your help.
>=20
------------=_1123261625-26505-157
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
------------=_1123261625-26505-157--