[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-365) Can't execute query

Wilberto Montoya (JIRA) noreply at atlassian.com
Thu Dec 4 12:15:16 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31884#action_31884 ] 

Wilberto Montoya commented on EJB-365:
--------------------------------------

OK i found the issue and I think I fixed it. It is just one line code change:

Revision: 15184 (hibernate 3.3.1 I guess)

class: org.hibernate.type.NullableType.java

line 147

			if ( value == null ) {
				if ( IS_VALUE_TRACING_ENABLED ) {
					log().trace( "binding null to parameter: " + index );
				}

				st.setNull( index, sqlType() );
			}
now:

			if ( value == null ) {
				if ( IS_VALUE_TRACING_ENABLED ) {
					log().trace( "binding null to parameter: " + index );
				}

				st.setNull( index, Types.NULL );
			}

and add the import:

import java.sql.Types;

I didn;t test it in another databases just postgreSQL 8.3

Hope this will help somebody.

Wilberto
		

> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the hibernate-issues mailing list