|
Re: Questions concering SQL Service [message #1268524 is a reply to message #1268439] |
Mon, 10 March 2014 16:16 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
This is a quick answer, I did not verify it
If the value returned by your database is NULL (the database null), your holder instance will not be null (as you assumed).
I think, the value will be null (the java null):
For your question about NULL versus empty String, I think you should try it. It might also depend on the Database engine. What are you using? MySQL?
I can remember of one usecase where the nullType parameter is usefull: when you pass a value to the SQL engine directly (as input parameter).
//with myDate beeing a java.util.Date
SQL.selectInto(
"INSERT INTO myTable (myCol) " +
"VALUES (:myColHolder) "
, new NVPair("myColHolder", myDate);
If myDate can be null, the NVPair cannot find out the type of myDate when it is null. This is because the type of null in Java is not known.("x instanceof SomeClass" is false if x is null)
In this case you will need something like:
new NVPair("myColHolder", myDate, Date.class);
If you need more information, feel free to tell. I could look deeper into it.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03036 seconds