Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.lxnx.fab.ess.DAO">
<class name="EssTpreferences" table="ESS_TPREFERENCES">
<id
column="PREF_PREFERENCE_TYPE"
name="PrefPreferenceType"
type="string"
>
<generator class="assigned" />
</id>
<property
column="BUSU_UNIT_CODE"
length="10"
name="BusuUnitCode"
not-null="false"
type="string"
/>
<property
column="PREF_PREFERENCE_DESCRIPTION"
length="50"
name="PrefPreferenceDescription"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>
I added 4 preferences.
For the next one I added 6 values for the above preferences.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.lxnx.fab.ess.DAO">
<class name="EssTbusinessUnitPreferences" table="ESS_TBUSINESS_UNIT_PREFERENCES">
<composite-id class="EssTbusinessUnitPreferencesPK" name="Id">
<key-property
column="PREF_PREFERENCE_TYPE"
name="PrefPreferenceType"
type="string"
/>
<key-many-to-one
class="EssTbusinessUnits"
column="BUSU_UNIT_CODE"
name="BusuUnitCode"
/>
</composite-id>
<property
column="PREF_PREFERENCE_VALUE"
length="50"
name="PrefPreferenceValue"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>
I am trying to access data from business unit preferences. It's simple
Code:
create session from session factory
session.find(query)
close session
I use EhCache 1.1 - which states that find on a primary object will go to the DB, but not for secondary tables. So, I tried loading the prefereces first, but it did not help; it only loads the initial set of values.
I tried setting cache to false; did not help. I dont need caching, since the database is not very large. Is there someway to completely turn off the cache?