BNO, I think you did not understand the Hibernate Mapping file.
<id name="id" column="fotosetnum">
<generator class="sequence">
<param name="sequence">pub."nextfotosetnum"</param>
</generator>
</id>
The above mapping means that the column fotosetnum is mapped to the
field variable id. Only when a new Photoset is created, the generator
sequence will be used to find the next non-used fotosetnum and inserts
that Photoset into the database.
As demonstrated from the SQL query generated by Hiberate, the sequence
will not be used for Queries and hence is not the reason why
Hibernate Query is running slower.
select photoset0_.fotosetnum as fotosetnum0_, photoset0_.fotosettitle
as fotosett2_0_ from pub.fotoset photoset0_
Thanks,
Joe.
On Fri, Apr 24, 2009 at 1:39 PM, <boliver(a)lvlomas.com> wrote:
Your Hibernate property mapping shows the column "fotosetnum" as coming
from a Progress sequence. So it will pick up a value from that sequence
for every row returned which will slow the query down. Your pure JDBC
query is simply querying the table and won't do anything with sequences.
Hope this helps.
BNO