[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-365?page=co...
]
Aleksandras Novikovas commented on EJB-365:
-------------------------------------------
Hi,
I've got exactly the same problem.
After digging for a few hours in the PostgreSQL JDBC and Hibernate sources I have to admit
that it is neither Hibernate nor PostgreSQL JDBC problem. It is a shortcoming of JPA.
Hibernate can detect and pass correct parameter type to JDBC when parameter has real
value. When you pass null - there is no possibility to determine parameter type and
Hibernate falls back to Hibernate.SERIALIZABLE which in turn translates into bytea (in
PostgreSQL JDBC).
Only workaround I've found is: get Hibernate query implementation and set parameter
with exact type.
javax.persistence.Query q = em.createNamedQuery ("MyNamedQuery");
org.hibernate.Query hq = ((org.hibernate.ejb.HibernateQuery) q).getHibernateQuery ();
hq.setParameter ("param", param, Hibernate.BOOLEAN);
Regards,
Alius
Can't execute query
-------------------
Key: EJB-365
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-365
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.2.GA
Environment: Hibernate 3.2.6
PostrgreSQL 8.0.13
Glassfish
Reporter: Radosław Smogura
Priority: Critical
Execution followed named query with followed entity
@Entity
@NamedQuery(name="Foo.test",
query="SELECT f FROM Foo f WHERE ((:bool IS NULL) OR (f.bool = :bool)) ")
public class Foo implements Serializable{
@Id
int id;
boolean bool;
public boolean isBool() {
return bool;
}
public void setBool(boolean bool) {
this.bool = bool;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
and parameter bool = null
causes PostgreSQL error ERROR: operator does not exist: boolean = bytea
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira