logo       

Re: AW: [enhydra] How set null value to integer or long DB field in DODS: msg#00016

java.enhydra.general

Subject: Re: AW: [enhydra] How set null value to integer or long DB field in DODS

That's not quite true. The following code will set specific BigInt
fields to NULL. It's a workaround.


DBConnection dbc = Enhydra.getDatabaseManager().allocateConnection();

dbc.setAutoCommit(false);

// For bid or salesorder, need some integer fields to be null
PreparedStatement ps2 = ((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 !
>
> 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...
>
> Greetings.
>
> Alfred
>
> -----Ursprüngliche Nachricht-----
> Von: Daniel Guryca [mailto:daniel.guryca@xxxxxxxxxx]
> 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
>
>
> I have a problem with setting DB field which is of type INTEGER or
> BIGINT.
>
> It is imposible to set this field with DO object to null value. (0 is
> 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) -
> because it gets java int (long) types only.
>
> So is there a way how to set or get a value of null for DB fields of
> type INTEGER or BIGINT?
>
> Thank you for your help.
>



--
You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx mailing
list.
To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise