[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6280?page=c...
]
Steve Ebersole updated HHH-6280:
--------------------------------
Suitable for new contributors: [Yes, likely]
Affects Version/s: (was: 3.6.3)
(was: 3.6.2)
(was: 3.6.1)
(was: 3.6.0)
(was: 3.5.6)
(was: 3.6.0.CR1)
(was: 3.6.0.Beta4)
(was: 3.6.0.Beta3)
(was: 3.6.0.Beta2)
(was: 3.6.0.CR2)
(was: 3.5.4)
(was: 3.5.3)
(was: 3.5.2)
(was: 3.5.0-Final)
(was: 3.5.1)
(was: 3.5.0-CR-1)
(was: 3.5.0-Beta-4)
(was: 3.5.0-CR-2)
(was: 3.5.0-Beta-3)
(was: 3.5.0-Beta-2)
(was: 3.6.0.Beta1)
(was: 3.5.0.Beta-1)
Fix Version/s: 4.0.0.next
Assignee: Steve Ebersole
Labels: jpa2 (was: )
There was a reason I ended up keeping numerics as literals in the SQL. But to be honest I
forget the reason at the moment. We can discuss this though. I am not for or against it
totally. Initially my hope was to have all the criteria literals be transformed into
parameters.
@William, there is a flip side to this argument. Some databases rely on the values being
literals for certain optimizations to be triggered. On Oracle for example if you want the
optimizer to select from a partition that will only be optimized as such if the partition
value is a literal. Yes the general case is that you would want these to get
parameterized; but the drawback is that there is no work around then for the cases where
you really want them as literals.
JPA criteria API don't bind numeric field
-----------------------------------------
Key: HHH-6280
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6280
Project: Hibernate Core
Issue Type: Improvement
Components: entity-manager
Affects Versions: 3.5.5, 3.6.4
Reporter: gwa
Assignee: Steve Ebersole
Labels: jpa2
Fix For: 4.0.0.next
When you use JPA criteria API, the numeric value are not binded but are directly set in
the SQL instead.
eq: you have a generated SQL like:
select ... from ... where age=12;
instead of
select ... from ... where age=?;
With '12' as parameter.
when you test the following code:
{code:java}
@Entity
public class User {
@Id
private int id;
private int age;
...
}
{code}
{code:java}
CriteriaBuilder builder=em.getCriteriaBuilder();
CriteriaQuery<User> query=builder.createQuery(User.class);
Root<User> root=query.from(User.class);
query.select(root).where(builder.equal(root.get("age"),12));
em.createQuery(query).getResultList();
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira