I would like to config the sample app petclinic from Springframework which use hibernate. It's working without problem but when I want to try 2nd Level cache using JBossCache, I found that hsql is always generated, which is not expected if it's already cache up for configured classes. And I found that the temp objects are created by JBossCache. Is there anyway to verify which part I done wrong? Thanks.
Hibernate version:
2.1
Mapping documents:
<hibernate-mapping auto-import="true">
<class name="org.springframework.samples.petclinic.Vet" table="vets">
<cache usage="read-only"/>
<id name="id" column="id" unsaved-value="-1">
<generator class="identity"/>
</id>
<property name="firstName" column="first_name"/>
<property name="lastName" column="last_name"/>
<set name="specialtiesInternal" table="vet_specialties">
<key column="vet_id"/>
<many-to-many column="specialty_id" class="org.springframework.samples.petclinic.Specialty"/>
</set>
</class>
Code between sessionFactory.openSession() and session.close():
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<value>petclinic.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
<prop key="hibernate.cache.provider_class">net.sf.hibernate.cache.TreeCacheProvider</prop>
</props>
</property>
</bean>
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Mysql 4.x
The generated SQL (show_sql=true):
Hibernate: select specialtie0_.vet_id as vet_id__, specialtie0_.specialty_id as
specialt2___, specialty1_.id as id0_, specialty1_.name as name0_ from vet_specia
lties specialtie0_ inner join specialties specialty1_ on specialtie0_.specialty_
id=specialty1_.id where specialtie0_.vet_id=?
Debug level Hibernate log excerpt:
|