shanika yrs
shanika yrs

Reputation: 323

Will spring getHibernateTemplate().find() return null or empty list when the results are not found to the given query?

I know hibernate query.list() method will always return an empty list instead of a null value

Likewise what will spring getHibernateTemplate().find() returns?

will it return null or empty list when the results for given query not found?

Thanks

Upvotes: 1

Views: 1186

Answers (1)

user4486340
user4486340

Reputation:

The HibernateTemplate will return an empty list. It calls Query#list() in its implementation as shown here (example for Spring 4 and Hibernate 4): http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-orm/4.2.0.RELEASE/org/springframework/orm/hibernate4/HibernateTemplate.java#HibernateTemplate.find%28java.lang.String%2Cjava.lang.Object%5B%5D%29

Upvotes: 1

Related Questions