From: <leg...@at...> - 2003-10-29 23:26:14
|
Message: The following issue has been closed. Resolver: Gavin King Date: Wed, 29 Oct 2003 5:25 PM Just use the form of setParameter() which takes an explicit Type. JDBC requires the typecode in setNull(). --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-433 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-433 Summary: Allow to bind null parameters to the query Type: Improvement Status: Closed Priority: Minor Resolution: REJECTED Project: Hibernate2 Components: core Versions: 2.1 beta 1 2.1 beta 2 2.1 final 2.1 beta 4 2.1 beta 5 Assignee: Reporter: Giedrius Trumpickas Created: Wed, 29 Oct 2003 12:15 PM Updated: Wed, 29 Oct 2003 5:25 PM Description: SELECT p FROM Person AS p WHERE ((? is null) OR (p.firstname = ?)) AND ((? is null) OR (p.lastname = ?)) This query assumes that person can be searched by firstname, lastname or both. Right now hibernate throws NullPointerException when I'm trying to bind null parameter because it tries to guess parameter type and ... Maybe in Hibernate we need to introduce NullType for scalar values ? Reason for such funcionality is to have dynamic searches from UI when user can enter bunch of search parameters and not all parameters are required. PS: I know that query above can be expressed by search criteria but this is just an example real query is more complicated and it can not be expressed with Criteria. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |