Author: mdryakhlenkov
Date: 2007-07-26 12:20:04 -0400 (Thu, 26 Jul 2007)
New Revision: 2688
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/nopojo/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/optional/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/singletable/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ops/Employer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/optlock/Document.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ordered/Search.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/orphan/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/pagination/DataPoint.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/basic/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/complete/Mapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/partial/Mapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/discrim/Person.hbm.xml
Log:
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/nopojo/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/nopojo/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/nopojo/Person.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.onetoone.nopojo">
+
+ <class entity-name="Person">
+ <id name="id" type="long">
+ <generator class="foreign">
+ <param name="property">address</param>
+ </generator>
+ </id>
+ <property name="name" type="string"/>
+ <one-to-one name="address" cascade="all"
entity-name="Address" constrained="true"/>
+ </class>
+
+ <class entity-name="Address">
+ <id name="id" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="street" type="string"/>
+ <property name="state" type="string"/>
+ <property name="zip" type="string"/>
+ <one-to-one name="owner" entity-name="Person" />
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/optional/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/optional/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/optional/Person.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Demonstrates mapping an "optional" one-to-one association. Basically
+ a (zero or one)-to-one.
+
+ Note that this is only conceptually possible on the non-constrained
+ side of the association (the side without the FK).
+
+ Also, it is impossible that the optional side be lazy; we must hit the
+ target table to determine whether a matching row actually exists or not.
+ This is so we can properly determine whether to use null or some value
+ for the association property's value.
+-->
+<hibernate-mapping package="mapping.onetoone.optional"
default-access="field">
+
+ <class name="Entity">
+ <id name="name"/>
+ <joined-subclass name="Person">
+ <key column="entityName"/>
+ <one-to-one name="address" cascade="all"
constrained="false" outer-join="false" lazy="proxy"/>
+ </joined-subclass>
+ <joined-subclass name="Org">
+ <key column="entityName"/>
+ </joined-subclass>
+ </class>
+
+ <class name="Address">
+ <id name="entityName"/>
+ <property name="street"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/singletable/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/singletable/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/onetoone/singletable/Person.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping
+ package="mapping.onetoone.singletable"
+ default-access="field">
+
+ <class name="Entity">
+ <id name="name"/>
+ <discriminator type="string" column="subtype"/>
+ <subclass name="Person">
+ <one-to-one name="address" cascade="all"/>
+ <one-to-one name="mailingAddress"
+ cascade="all"
+ entity-name="MailingAddress"/>
+ </subclass>
+ <subclass name="Org">
+ <set name="addresses" inverse="true"
cascade="all-delete-orphan">
+ <key column="entityName"/>
+ <one-to-many class="Address"/>
+ </set>
+ </subclass>
+ </class>
+
+ <class name="Address">
+ <id name="entityName"/>
+
+ <property name="street"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+ <class name="Address" entity-name="MailingAddress">
+ <id name="entityName"/>
+ <property name="street"/>
+ <property name="state"/>
+ <property name="zip"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ops/Employer.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ops/Employer.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ops/Employer.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.ops">
+
+ <class name="Employer" polymorphism="explicit">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <version column="vers" name="vers"/>
+ <bag name="employees"
+ cascade="persist,merge"
+ table="EMPLOYER_EMPLOYEE">
+ <key column="EMPER_ID"/>
+ <many-to-many class="Employee" column="EMPEE_ID" />
+ </bag>
+ </class>
+
+ <class name="Employee" polymorphism="explicit">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <bag name="employers"
+ inverse="true"
+ cascade="persist,merge,save-update"
+ table="EMPLOYER_EMPLOYEE">
+ <key column="EMPEE_ID"/>
+ <many-to-many class="Employer" column="EMPER_ID" />
+ </bag>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/optlock/Document.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/optlock/Document.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/optlock/Document.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Demonstrates the use of dirty-property optimistic locking.
+ We do not recommend this approach, since it does not work
+ for detached entities. Use version-based optimistic locking.
+
+-->
+
+<hibernate-mapping package="mapping.optlock">
+
+ <class name="Document" entity-name="LockDirty"
table="Document" optimistic-lock="dirty"
dynamic-update="true">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="title"/>
+ <property name="author"/>
+ <component name="pubDate">
+ <property name="year" not-null="true"/>
+ <property name="month"/>
+ </component>
+ <property name="summary"/>
+ <property name="totalSales" optimistic-lock="false"/>
+ <property name="text" column="`text`"/>
+ </class>
+
+ <class name="Document" entity-name="LockAll"
table="Document" optimistic-lock="all"
dynamic-update="true">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="title"/>
+ <property name="author"/>
+ <component name="pubDate">
+ <property name="year" not-null="true"/>
+ <property name="month"/>
+ </component>
+ <property name="summary"/>
+ <property name="totalSales" optimistic-lock="false"/>
+ <property name="text" column="`text`"/>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ordered/Search.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ordered/Search.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ordered/Search.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.ordered">
+
+ <class name="Search">
+ <id name="searchString"/>
+ <set name="searchResults" order-by="lower(text) asc">
+ <key column="searchString"/>
+ <element column="text" type="string"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/orphan/User.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/orphan/User.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/orphan/User.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ '-//Hibernate/Hibernate Mapping DTD 3.0//EN'
+ 'http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd'>
+
+<hibernate-mapping package="mapping.orphan" >
+
+ <class name="User" table="t_user">
+
+ <id name="id" type="integer" column="id">
+ <generator class="native" />
+ </id>
+
+ <property name="userid">
+ <column name="userid" length="32"
not-null="true"/>
+ </property>
+
+ <set name="mail" table="mail" cascade="all,
delete-orphan" inverse="true" lazy="false">
+ <key column="userid" property-ref="userid"
not-null="false"/>
+ <one-to-many class="Mail"/>
+ </set>
+
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/pagination/DataPoint.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/pagination/DataPoint.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/pagination/DataPoint.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping
+ package="mapping.pagination">
+
+ <class name="DataPoint"
+ dynamic-update="true">
+ <!--rowid="rowid"--> <!-- remove this if not oracle -->
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="x">
+ <column name="xval" not-null="true" precision="4"
unique-key="xy"/>
+ </property>
+ <property name="y">
+ <column name="yval" not-null="true" precision="4"
unique-key="xy"/>
+ </property>
+ <property name="description"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/basic/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/basic/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/basic/Person.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Demonstrates the use of property-ref to map legacy data where
+ foreign keys reference something other than the primary key of
+ the associated entity. Here we show:
+
+ (1) A one-to-one foreign key association (prefer primary key
+ associations)
+
+ (2) A bidirectional one-to-many association on a key that is
+ not the primary key (prefer associations from foreign keys
+ to primary keys)
+
+-->
+
+<hibernate-mapping package="mapping.propertyref.basic">
+
+ <class name="Person" table="PROPREF_PERS">
+ <id name="id">
+ <generator class="hilo"/>
+ </id>
+ <property name="name" length="100"/>
+ <property name="userId" column="person_userid"
length="8" unique="true"/>
+ <one-to-one name="address" property-ref="person"
cascade="all" fetch="join"/>
+ <set name="accounts" inverse="true">
+ <key column="userId" property-ref="userId"/>
+ <one-to-many class="Account"/>
+ </set>
+ <bag name="systems" table="USER_SYSTEM"
lazy="true" inverse="false" cascade="all">
+ <key column="USER_ID" property-ref="userId" />
+ <element type="string" column="SYSTEM" />
+ </bag>
+ </class>
+
+ <class name="Address" table="PROPREF_ADDR">
+ <id name="id">
+ <generator class="hilo"/>
+ </id>
+ <property name="address" length="300"/>
+ <property name="zip" length="5"/>
+ <property name="country" length="25"/>
+ <many-to-one name="person" unique="true"
not-null="true"/>
+ </class>
+
+ <class name="Account" table="PROPREF_ACCT">
+ <id name="accountId" length="32">
+ <generator class="uuid.hex"/>
+ </id>
+ <many-to-one name="user" column="userId"
property-ref="userId"/>
+ <property name="type" not-null="true"/>
+ </class>
+
+ <class name="Group" table="PROPREF_GRP">
+ <id name="name"/>
+ <set name="users" table="PROPREF_USERGROUP"
cascade="save-update">
+ <key column="groupName"/>
+ <many-to-many column="userId" class="Person"
property-ref="userId"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/complete/Mapping.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/complete/Mapping.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/complete/Mapping.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+
+-->
+
+<hibernate-mapping package="mapping.propertyref.component.complete">
+
+ <class name="Person" table="COMP_COMP_PROPREF_PERSON">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <component name="identity" class="Identity">
+ <property name="name"/>
+ <property name="ssn" unique="true"/>
+ </component>
+ </class>
+
+ <class name="Account" table="COMP_COMP_PROPREF_ACCT">
+ <id name="number" column="accnum"/>
+ <many-to-one name="owner" property-ref="identity">
+ <column name="OWNER_NAME" />
+ <column name="OWNER_SSN" />
+ </many-to-one>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/partial/Mapping.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/partial/Mapping.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/component/partial/Mapping.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+
+-->
+
+<hibernate-mapping package="mapping.propertyref.component.partial">
+
+ <class name="Person" table="PART_COMP_PROPREF_PERS">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <component name="identity">
+ <property name="name"/>
+ <property name="ssn" unique="true"/>
+ </component>
+ </class>
+
+ <class name="Account" table="PART_COMP_PROPREF_ACCT">
+ <id name="number" column="accnum"/>
+ <many-to-one name="owner" property-ref="identity.ssn"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/discrim/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/discrim/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/discrim/Person.hbm.xml 2007-07-26
16:20:04 UTC (rev 2688)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.propertyref.inheritence.discrim">
+
+ <class name="Person" discriminator-value="null"
table="D_SBCLS_PROPREF_PERS">
+ <id name="id">
+ <generator class="hilo"/>
+ </id>
+ <discriminator formula="customerId"/>
+ <property name="name" length="100"/>
+ <property name="personId" length="8"
unique="true"/>
+
+ <subclass name="Customer" discriminator-value="not null">
+ <property name="customerId" length="8"
unique="true"/>
+ </subclass>
+ </class>
+
+ <class name="Account" table="D_SBCLS_PROPREF_ACCT">
+ <id name="accountId" length="32">
+ <generator class="uuid.hex"/>
+ </id>
+ <many-to-one name="person" column="personId"
unique="true" property-ref="personId"/>
+ <many-to-one name="customer" column="customerPersonId"
unique="true" property-ref="personId"/>
+ <property name="type" not-null="true"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file