blob: 337bde9d60e1130a23e2b6a7478a4922e1e7309c [file] [log] [blame]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 1.1//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"
>
<hibernate-mapping>
<class name="wicket.examples.cdapp.model.CD" table="cd">
<id name="id" column="id" type="java.lang.Long" unsaved-value="any">
<generator class="native" />
</id>
<property name="title" type="string" column="title" not-null="true" />
<property name="performers" type="string" column="performers" not-null="true" />
<property name="label" type="string" column="label" not-null="false" />
<property name="year" type="integer" column="year_release" not-null="false" />
<property name="description" type="string" column="description" not-null="false" />
<property name="rating" type="integer" column="rating" not-null="false" />
<property name="image" type="binary" column="image" not-null="false" />
<list name="tracks" lazy="false" inverse="true" cascade="all">
<key column="cd_id" />
<index column="number" />
<one-to-many class="wicket.examples.cdapp.model.Track" />
</list>
<set name="categories" table="cdcategory" lazy="false" cascade="none" sort="unsorted">
<key column="cdid" />
<many-to-many class="wicket.examples.cdapp.model.Category"
column="categoryid" outer-join="auto" />
</set>
</class>
<query name="wicket.examples.cdapp.model.SearchCD">
<![CDATA[
SELECT cd FROM wicket.examples.cdapp.model.CD as cd
WHERE (:title is null or upper(cd.title) like :title)
OR (:performers is null or upper(cd.performers) like :performers)
OR (:label is null or upper(cd.label) like :label)
]]>
</query>
<query name="wicket.examples.cdapp.model.SearchCD.count">
<![CDATA[
SELECT count(cd.id) FROM wicket.examples.cdapp.model.CD as cd
WHERE (:title is null or upper(cd.title) like :title)
OR (:performers is null or upper(cd.performers) like :performers)
OR (:label is null or upper(cd.label) like :label)
]]>
</query>
</hibernate-mapping>