Problem definition:
javax.persistence.Query interface has not defined "typed" setPrarameter
methods.
There exists valid queries that can't be parametrized properly via
methods in javax.persistence.Query.
details:
in java.sql.PreparedStatement exists only two method for setting null
values, namely setNull(int parameterIndex, int sqlType) && setNull(int
parameterIndex, int sqlType, String typeName).
If we need pass valid null value into the query, these methods must be used.
In hibernate Query interface (org.hibernate.Query) exists method Query
setParameter(int position, Object val, Type type) that solve this problem.
So, we need define more rich API in javax.persistence.Query interface to
pass "types" into a Query.
probably we need add methods :
public Query setParameter(int position, Type value)
public Query setParameter(String name, Type value), where Type is from
Long, Boolean ...., in general NullableType see
org.hibernate.type.NullableType.
Problem is that fixes in EJB 3 specification are necessary. :-(
remarks:
org.hibernate.Query is not well object oriented.
I mean that methods like setInteger, setBoolean ... should be "marked"
obsolete and should be replaced with methods setParamater(int,
int)/setParameter(String, int), setParameter(int,
boolean)/setParameter(String boolean) ... in future releases.
best regards
JuBu
p.s. sorry for my weak English
|||
|
|||
|
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel