[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6280?page=c...
]
William Ashley edited comment on HHH-6280 at 8/20/11 8:15 PM:
--------------------------------------------------------------
A couple of ideas off the top of my head:
- Literal expressions could be parameterized if the underlying property is mapped with a
UserType (or otherwise is transformed between Java and SQL)
- Perhaps this inlining optimization should have to be explicitly activated by some sort
of property-level metadata (a hibernate-specific annotation would probably be required)
Thoughts?
was (Author: washley):
A couple of ideas off the top of my head:
- Literal expressions could be parameterized if the underlying property is mapped with a
UserType (or otherwise isn't transformed between Java and SQL)
- Perhaps this inlining optimization should have to be explicitly activated by some sort
of property-level metadata (a hibernate-specific annotation would probably be required)
Thoughts?
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