由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Spring Library Bug?
相关主题
一大堆Java的 web app framework,学那个最有用啊java reflecton question: how to represent a String[] class?
spring到底有什么好处?Where can I find the definition of the method: java.lang.System.getProperties().list()
is there anyway that i can return...guessContentTypeFromStream(InputStream)总是返回null怎么办?
在一个函数里把arraylist设为null 但是有问题Java SVN library?
question about Exeption请问protected的使用
Java练习题 5请问一个ehcache的问题
这段程序的输出是什么? 为什么找工作时Spring面试一般问题会怎么问?
JAVA 考试题请教如何学spring和hibernate
相关话题的讨论汇总
话题: method话题: returns话题: null话题: library
进入Java版参与讨论
1 (共1页)
s****e
发帖数: 19
1
I used the following method from JdbcTemplate class:
public long queryForLong(String sql, Object[] args) throws
DataAccessException
From the API, it says if the query returns null, the method returns a 0.
However, I tried all that I can to see what the value is returned from this
method, I couldn't get anything. It seems like if the query returns null,
this method doesn't return at all.
Has anyone have the same problem before?
g*****g
发帖数: 34805
2
What do you mean not return at all?
If an exception is throwed, that's not a surprise.

this

【在 s****e 的大作中提到】
: I used the following method from JdbcTemplate class:
: public long queryForLong(String sql, Object[] args) throws
: DataAccessException
: From the API, it says if the query returns null, the method returns a 0.
: However, I tried all that I can to see what the value is returned from this
: method, I couldn't get anything. It seems like if the query returns null,
: this method doesn't return at all.
: Has anyone have the same problem before?

A**o
发帖数: 1550
3
are you using debugger? where it goes if not returning?

this

【在 s****e 的大作中提到】
: I used the following method from JdbcTemplate class:
: public long queryForLong(String sql, Object[] args) throws
: DataAccessException
: From the API, it says if the query returns null, the method returns a 0.
: However, I tried all that I can to see what the value is returned from this
: method, I couldn't get anything. It seems like if the query returns null,
: this method doesn't return at all.
: Has anyone have the same problem before?

s****e
发帖数: 19
4
Ah... I just realized that following exception is thrown:
org.springframework.dao.EmptyResultDataAccessException: Incorrect result
size: expected 1, actual 0
However, I am still not quite sure how to use QueryForLong() in the case
when sql returns null.
Thanks for helping.
m******t
发帖数: 2416
5
queryForLong only handles a null value returned in the target column on an _
actual_ result row, but not an empty result set. From the exception, it
looks like that's what your sql is returning.
s****e
发帖数: 19
6
hmm.. that really makes sense. Thanks so much!
1 (共1页)
进入Java版参与讨论
相关主题
如何学spring和hibernatequestion about Exeption
讨论spring这么多,还没有说到点子上的。Java练习题 5
hibernate一个国际化保存unicode value的问题这段程序的输出是什么? 为什么
java.lang.OutOfMemoryError: Java heap space in DB queryJAVA 考试题请教
一大堆Java的 web app framework,学那个最有用啊java reflecton question: how to represent a String[] class?
spring到底有什么好处?Where can I find the definition of the method: java.lang.System.getProperties().list()
is there anyway that i can return...guessContentTypeFromStream(InputStream)总是返回null怎么办?
在一个函数里把arraylist设为null 但是有问题Java SVN library?
相关话题的讨论汇总
话题: method话题: returns话题: null话题: library