Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="org.hibernate.test.Product" table="t$Product" lazy="false">
<id type="long" name="id" column="id$">
<generator class="identity"/>
</id>
<property name="vendor" type="string" length="254">
<column name="vendor" index="idx_product_ven_nam_ver"/>
</property>
<property name="name" type="string" length="254">
<column name="name" index="idx_product_ven_nam_ver"/>
</property>
<property name="version" type="string" length="64">
<column name="version" index="idx_product_ven_nam_ver"/>
</property>
<property name="category" type="string" length="64"/>
<property name="helplink" type="string" length="254"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Query q_product=s.createSQLQuery("select {p}.id$ as {p.id} from t$Product {p} where {p}.vendor=? and {p}.name=? and {p}.version=?","p",Product.class).setFirstResult(0).setMaxResults(1).setCacheable(true).setCacheRegion("frontpages");
q_product.setString(0,"Vendor");
q_product.setString(1,"Name");
q_product.setString(2,"Version");
Product product=(Product)q_product.uniqueResult();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Quote:
In the above query, I am experiencing a serious performance degradation (about 4 times slower) with hibernate compared to JDBC ?. Is there a better way to query? or is there problem in mapping? pl help