Hibernate version: 2.1.6
Mapping documents: Partial definition follows.
Code:
<id
name="id"
type="java.lang.Long"
column="id"
>
<generator class="native"/>
</id>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Data base server: Postgres 7.4.3
The generated SQL (show_sql=true):Code:
update WeatherArchive set rain_mm=?, ...etc, where id=?
Is there a way to force the generated SQL for an update to include an explicit cast on the columns used in the where clause?
For instance, I need the above update SQL to look like this:
Code:
update WeatherArchive set rain_mm=?, ...etc, where id::bigint?
Notice the cast of the id column in the where clause. The reason I ask has to do with the way Postgres uses (or, in my cast, does not use) indexes. If the value assigned to id in the update statement is an int (int4, the default) a sequential scan results. If the value assigned to id is casted as a bigint (int8) an index scan results.