Hibernate version: 3.0.5
Mapping documents:
I have noticed some typos in my prevoius post in *hbm.xml exerpts.
Here is the correct versions:
<hibernate-mapping>
<class table="EMPLOYEES" name="Employee">
<id unsaved-value="null" name="id">
<column name="EMPLOYEE_ID" not-null="true"/>
<generator class="sequence"/>
</id>
<many-to-one insert="false" column="JOB_ID" foreign-key="JOB_EMPLOYEE_FK" update="false" class="Job" lazy="false" name="job"/>
</class>
</hibernate-mapping>
**************************************************************************
<hibernate-mapping>
<class name="JOB" table="JOBS" lazy="false">
<id
name="id"
type="long"
column="JOB_ID">
<generator class="sequence"/>
</id>
<property
name="descr"
column="DESCR"
type="string"
not-null="false"
length="255"/>
<list name="employees" inverse="false" cascade="all" table="EMPLOYEES" lazy="false">
<key column="JOB_ID"/>
<list-index column="DISPLAY_IDX" base="0"/>
<one-to-many class="Employee"/>
</list>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
I am using Spring's HibernateTemplate it takes care of session handling.
Full stack trace of any exception that occurs: Job is not refreshed
Name and version of the database you are using: Oracle 10g
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt generated by refresh method:
Hibernate: select employee0_.EMPLOYEE_ID as EMPLOYEE1_1_, employee0_.JOB_ID as JOB2_16_1_, job1_.JOB_ID as JOB1_0_, job1_.DESCR as DESCR13_0_ from EMPLOYEES employee0_, JOBS job1_ where employee0_.JOB_ID=job1_.JOB_ID(+) and employee0_.EMPLOYEE_ID=?
Hibernate: select employees0_.JOB_ID as JOB2_1_, employees0_.EMPLOYEE_ID as EMPLOYEE1_1_, employees0_.DISPLAY_IDX as DISPLAY3_1_, employees0_.EMPLOYEE_ID as EMPLOYEE1_0_, employees0_.JOB_ID as JOB2_16_0_ from EMPLOYEES employees0_ where employees0_.JOB_ID=?
Hibernate: select job0_.JOB_ID as JOB1_0_, job0_.DESCR as DESCR13_0_ from JOBS job0_ where job0_.JOB_ID=?
When I set inverse="true" hibernate generates only two bottom select statements of the log above
I am using Spring 1.2
Here is excerpt from applicationContext.xml
<property name="hibernateProperties">
<props>
<!--<prop key="hibernate.cache.provider_class">org.hibernate.cache.CoherenceCacheProvider</prop>->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
<prop key="hibernate.cache.region_prefix">myWebApp</prop>
</props>
</property>
I have tried to run the test with "<cache usage..." in *hbm.xml files and <prop key="hibernate.cache.provider_class...> in applicationContext.xml commented out with the same result.
|