1 Reply Latest reply on Aug 17, 2005 5:59 AM by Emmanuel Bernard

    boolean parameters

    justinb Newbie


      I'm using OracleDialect with EJB RC1

      I'm not sure if there is a proper way to do this, but I have a query like this:

      SELECT x FROM Resource x WHERE :visibleOnly = false OR x.visible = true

      Resource has a boolean property called "visible".

      I get an Oracle error saying "Invalid column name". I checked the debug logs and noticed that hibernate was not changing the boolean values to sql 1s and 0s in the (impressive) sql that it generates. So now I've changed the query to

      SELECT x FROM Resource x WHERE :visibleOnly = 0 OR x.visible = 1

      and set the "visibleOnly" parameter to 1 or 0, and now it works...

      Is this my mistake? Can I leave my query like it is now? Is it wrong to use booleans as parameters?