@NativeQuery
List<OperationUnit> findOperationUnitByOuTypeIDSql(@QueryParam("ouTypeId") Long ouTypeId, @QueryParam("isAvailable") Boolean isAvailable, RowMapper<OperationUnit> rowMapper);
我的查詢:映射休眠布爾值SMALLINT PostgreSQL的
select * from t_au_operation_unit where OU_TYPE_ID = :ouTypeId and is_available = :isAvailable order by name asc;
我有在Java中。隨着這個功能你可以看到,isAvailable
是布爾類型。但是,Postgres db中的相關列是smallint
類型。因此,我有這種錯誤
ERROR: operator does not exist: smallint = boolean
爲什麼要將'boolean'存儲爲'smallint'而不是'boolean '? –
因爲我做了從oracle到pgsql的數據庫轉換。在oracle中,列is_avaiable爲NUMBER(1),Pgsql中的相關類型爲smallint –