Author: mdryakhlenkov
Date: 2007-07-31 13:06:06 -0400 (Tue, 31 Jul 2007)
New Revision: 2774
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Account.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Container.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Info.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Owner.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Child.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Mappings.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Parent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/RowIdType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/1_Version.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/2_Version.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/Version.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Paper.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent2.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Country.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Locality.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Province.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/State.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/discrim-subclass.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/joined-subclass.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/union-subclass.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Alien.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Being.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Beings.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Human.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Child.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Parent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/ParentChild.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Site.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Ternary.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tm/Item.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/AddressId.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/AddressId.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.java
Modified:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/array/A.hbm.xml
Log:
Modified:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/array/A.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/array/A.hbm.xml 2007-07-31
17:03:48 UTC (rev 2773)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/array/A.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -12,9 +12,9 @@
-->
<hibernate-mapping
- package="mapping.array">
+ package="mapping.array" schema="schema1"
catalog="catalog1">
- <class name="A" lazy="true" table="aaa">
+ <class name="A" lazy="true" table="aaa"
schema="schema1" catalog="catalog1">
<id name="id">
<generator class="native"/>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Account.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Account.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Account.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,56 @@
+package mapping.propertyref.inheritence.union;
+
+/**
+ * @author Gavin King
+ */
+public class Account {
+ private String accountId;
+ private Customer customer;
+ private Person person;
+ private char type;
+ /**
+ * @return Returns the user.
+ */
+ public Customer getCustomer() {
+ return customer;
+ }
+ /**
+ * @param user The user to set.
+ */
+ public void setCustomer(Customer user) {
+ this.customer = user;
+ }
+ /**
+ * @return Returns the accountId.
+ */
+ public String getAccountId() {
+ return accountId;
+ }
+ /**
+ * @param accountId The accountId to set.
+ */
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+ /**
+ * @return Returns the type.
+ */
+ public char getType() {
+ return type;
+ }
+ /**
+ * @param type The type to set.
+ */
+ public void setType(char type) {
+ this.type = type;
+ }
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Customer.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Customer.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Customer.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,17 @@
+package mapping.propertyref.inheritence.union;
+
+/**
+ * @author Gavin King
+ */
+public class Customer extends Person {
+ private String customerId;
+
+ public String getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,29 @@
+<?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.union">
+
+ <class name="Person" table="U_SBCLS_PROPREF_PERS">
+ <id name="id">
+ <generator class="hilo"/>
+ </id>
+ <property name="name" length="100"/>
+ <property name="personId" length="8"
unique="true"/>
+
+ <union-subclass name="Customer"
table="U_SBCLS_PROPREF_CUST">
+ <property name="customerId" length="8"
unique="true"/>
+ </union-subclass>
+ </class>
+
+ <class name="Account" table="U_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
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/union/Person.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,42 @@
+package mapping.propertyref.inheritence.union;
+
+/**
+ * @author gavin
+ */
+public class Person {
+ private Long id;
+ private String name;
+ private String personId;
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(String personId) {
+ this.personId = personId;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Container.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Container.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Container.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,63 @@
+package mapping.proxy;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.io.Serializable;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Container implements Serializable {
+ private Long id;
+ private String name;
+ private Owner owner;
+ private Info info;
+ private Set dataPoints = new HashSet();
+
+ public Container() {
+ }
+
+ public Container(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Owner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(Owner owner) {
+ this.owner = owner;
+ }
+
+ public Info getInfo() {
+ return info;
+ }
+
+ public void setInfo(Info info) {
+ this.info = info;
+ }
+
+ public Set getDataPoints() {
+ return dataPoints;
+ }
+
+ public void setDataPoints(Set dataPoints) {
+ this.dataPoints = dataPoints;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,49 @@
+<?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.proxy">
+
+ <class name="DataPoint">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="x">
+ <column name="xval" not-null="true" length="4"
unique-key="xy"/>
+ </property>
+ <property name="y">
+ <column name="yval" not-null="true" length="4"
unique-key="xy"/>
+ </property>
+ <property name="description"/>
+ </class>
+
+ <class name="Owner">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name" unique="true"/>
+ </class>
+
+ <class name="Info">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="details"/>
+ </class>
+
+ <class name="Container">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <many-to-one name="owner" class="Owner"
column="owner_name" property-ref="name" cascade="all"/>
+ <many-to-one name="info" class="Info"
column="info_id" cascade="all"/>
+ <set name="dataPoints" lazy="true"
inverse="false" cascade="all">
+ <key column="c_id"/>
+ <one-to-many class="DataPoint"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/DataPoint.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,77 @@
+//$Id: DataPoint.java 10225 2006-08-04 20:33:48Z steve.ebersole(a)jboss.com $
+package mapping.proxy;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author Gavin King
+ */
+public class DataPoint implements Serializable {
+ private long id;
+ private BigDecimal x;
+ private BigDecimal y;
+ private String description;
+
+ public DataPoint() {
+ }
+
+ public DataPoint(BigDecimal x, BigDecimal y, String description) {
+ this.x = x;
+ this.y = y;
+ this.description = description;
+ }
+
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the x.
+ */
+ public BigDecimal getX() {
+ return x;
+ }
+ /**
+ * @param x The x to set.
+ */
+ public void setX(BigDecimal x) {
+ this.x = x;
+ }
+ /**
+ * @return Returns the y.
+ */
+ public BigDecimal getY() {
+ return y;
+ }
+ /**
+ * @param y The y to set.
+ */
+ public void setY(BigDecimal y) {
+ this.y = y;
+ }
+
+ void exception() throws Exception {
+ throw new Exception("foo");
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Info.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Info.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Info.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,34 @@
+package mapping.proxy;
+
+/**
+ * todo: describe Info
+ *
+ * @author Steve Ebersole
+ */
+public class Info {
+ private Long id;
+ private String details;
+
+ public Info() {
+ }
+
+ public Info(String details) {
+ this.details = details;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getDetails() {
+ return details;
+ }
+
+ public void setDetails(String details) {
+ this.details = details;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Owner.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Owner.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/proxy/Owner.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,34 @@
+package mapping.proxy;
+
+import java.io.Serializable;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Owner implements Serializable {
+ private Long id;
+ private String name;
+
+ public Owner() {
+ }
+
+ public Owner(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,17 @@
+<?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.querycache">
+
+ <class name="Item" table="Items" batch-size="9">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name" not-null="true"/>
+ <property name="description" not-null="true"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/querycache/Item.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,34 @@
+//$Id: Item.java 9587 2006-03-09 21:38:26Z steve.ebersole(a)jboss.com $
+package mapping.querycache;
+
+import java.util.Set;
+import java.util.HashSet;
+
+
+/**
+ * @author Gavin King
+ */
+public class Item {
+ private long id;
+ private String name;
+ private String description;
+
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.readonly">
+
+ <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="25"
scale="20" unique-key="xy"/>
+ </property>
+ <property name="y">
+ <column name="yval" not-null="true" precision="25"
scale="20" unique-key="xy"/>
+ </property>
+ <property name="description"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/readonly/DataPoint.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,62 @@
+//$Id: DataPoint.java 7231 2005-06-19 22:04:00Z oneovthafew $
+package mapping.readonly;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Gavin King
+ */
+public class DataPoint {
+ private long id;
+ private BigDecimal x;
+ private BigDecimal y;
+ private String description;
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the x.
+ */
+ public BigDecimal getX() {
+ return x;
+ }
+ /**
+ * @param x The x to set.
+ */
+ public void setX(BigDecimal x) {
+ this.x = x;
+ }
+ /**
+ * @return Returns the y.
+ */
+ public BigDecimal getY() {
+ return y;
+ }
+ /**
+ * @param y The y to set.
+ */
+ public void setY(BigDecimal y) {
+ this.y = y;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Child.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Child.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Child.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,34 @@
+package mapping.reattachment;
+
+/**
+ * Child entity
+ *
+ * @author Steve Ebersole
+ */
+public class Child {
+ private String name;
+ private Parent parent;
+
+ public Child() {
+ }
+
+ public Child(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Parent getParent() {
+ return parent;
+ }
+
+ public void setParent(Parent parent) {
+ this.parent = parent;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Mappings.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Mappings.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Mappings.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,23 @@
+<?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.reattachment">
+
+ <class name="Parent">
+ <id name="name" column="NAME" type="string" />
+ <many-to-one name="other" class="Parent"
column="OTHER_ID" lazy="proxy"/>
+ <set name="children" inverse="true"
cascade="all">
+ <key column="PARENT" />
+ <one-to-many class="Child" />
+ </set>
+ </class>
+
+ <class name="Child">
+ <id name="name" column="NAME"
type="string"/>
+ <many-to-one name="parent" class="Parent"
cascade="none" />
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Parent.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Parent.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/reattachment/Parent.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,51 @@
+package mapping.reattachment;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Parent entity
+ *
+ * @author Steve Ebersole
+ */
+public class Parent {
+ private String name;
+ private Parent other;
+ private Set children = new HashSet();
+
+ public Parent() {
+ }
+
+ public Parent(String name) {
+ this.name = name;
+ }
+
+ public Parent(String name, Parent other) {
+ this.name = name;
+ this.other = other;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Parent getOther() {
+ return other;
+ }
+
+ public void setOther(Parent other) {
+ this.other = other;
+ }
+
+ public Set getChildren() {
+ return children;
+ }
+
+ public void setChildren(Set children) {
+ this.children = children;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.rowid">
+
+ <typedef name="rowid"
class="org.hibernate.test.rowid.RowIdType"/>
+
+ <class name="Point" rowid="rowid">
+ <composite-id>
+ <key-property name="x" column="`x`"/>
+ <key-property name="y" column="`y`"/>
+ </composite-id>
+ <property name="description"/>
+ <property name="row" type="rowid" column="rowid"
insert="false" update="false"/>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/Point.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,55 @@
+//$Id: Point.java 6477 2005-04-21 07:39:21Z oneovthafew $
+package mapping.rowid;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author Gavin King
+ */
+public class Point implements Serializable {
+ private BigDecimal x;
+ private BigDecimal y;
+ private String description;
+ private Object row;
+
+ Point() {}
+
+ public Point(BigDecimal x, BigDecimal y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public BigDecimal getX() {
+ return x;
+ }
+
+ void setX(BigDecimal x) {
+ this.x = x;
+ }
+
+ public BigDecimal getY() {
+ return y;
+ }
+
+ void setY(BigDecimal y) {
+ this.y = y;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Object getRow() {
+ return row;
+ }
+
+ public void setRow(Object row) {
+ this.row = row;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/RowIdType.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/RowIdType.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/rowid/RowIdType.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,64 @@
+//$Id: RowIdType.java 6477 2005-04-21 07:39:21Z oneovthafew $
+package mapping.rowid;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+import org.hibernate.HibernateException;
+import org.hibernate.usertype.UserType;
+
+/**
+ * @author Gavin King
+ */
+public class RowIdType implements UserType {
+
+ public int[] sqlTypes() {
+ return new int[] { Types.JAVA_OBJECT };
+ }
+
+ public Class returnedClass() {
+ return Object.class;
+ }
+
+ public boolean equals(Object x, Object y) throws HibernateException {
+ return x.equals(y);
+ }
+
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
+ throws HibernateException, SQLException {
+ return rs.getObject( names[0] );
+ }
+
+ public void nullSafeSet(PreparedStatement st, Object value, int index)
+ throws HibernateException, SQLException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object deepCopy(Object value) throws HibernateException {
+ return value;
+ }
+
+ public boolean isMutable() {
+ return false;
+ }
+
+ public Serializable disassemble(Object value) throws HibernateException {
+ return null;
+ }
+
+ public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ return null;
+ }
+
+ public Object replace(Object original, Object target, Object owner) throws
HibernateException {
+ return null;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/1_Version.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/1_Version.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/1_Version.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,19 @@
+<?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.schemaupdate">
+
+ <class name="Version">
+ <id name="id">
+ <generator class="org.hibernate.id.TableHiLoGenerator">
+ <param name="table">uid_table</param>
+ <param name="column">next_hi_value_column</param>
+ </generator>
+ </id>
+ <property name="description"/>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/2_Version.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/2_Version.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/2_Version.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.schemaupdate">
+
+ <class name="Version" schema="PUBLIC">
+ <id name="id">
+ <generator class="org.hibernate.id.TableHiLoGenerator">
+ <param name="table">uid_table</param>
+<!-- <param name="schema">PUBLIC</param>
-->
+ <param name="column">next_hi_value_column</param>
+ </generator>
+ </id>
+ <property name="description"/>
+ <property name="name"/>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/Version.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/Version.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/schemaupdate/Version.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,30 @@
+package mapping.schemaupdate;
+
+public class Version {
+
+ long id;
+ String name;
+ String description;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.sorted">
+
+ <class name="Search">
+ <id name="searchString"/>
+ <set name="searchResults" sort="natural">
+ <key column="searchString"/>
+ <element column="text" type="string"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/sorted/Search.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,29 @@
+//$Id: Search.java 7772 2005-08-05 23:03:46Z oneovthafew $
+package mapping.sorted;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class Search {
+ private String searchString;
+ private SortedSet searchResults = new TreeSet();
+
+ Search() {}
+
+ public Search(String string) {
+ searchString = string;
+ }
+
+ public SortedSet getSearchResults() {
+ return searchResults;
+ }
+ public void setSearchResults(SortedSet searchResults) {
+ this.searchResults = searchResults;
+ }
+ public String getSearchString() {
+ return searchString;
+ }
+ public void setSearchString(String searchString) {
+ this.searchString = searchString;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,27 @@
+<?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.stateless">
+
+ <class name="Document">
+ <id name="name"/>
+ <timestamp name="lastModified"/>
+ <property name="text"/>
+ </class>
+
+ <class name="Paper">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="color"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Document.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,46 @@
+//$Id: Document.java 8057 2005-08-31 23:19:53Z oneovthafew $
+package mapping.stateless;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class Document {
+
+ private String text;
+ private String name;
+ private Date lastModified;
+
+ Document() {}
+
+ public Document(String text, String name) {
+ this.text = text;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public Date getLastModified() {
+ return lastModified;
+ }
+
+ void setLastModified(Date lastModified) {
+ this.lastModified = lastModified;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Paper.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Paper.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stateless/Paper.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,26 @@
+//$Id: Paper.java 8048 2005-08-30 21:27:17Z epbernard $
+package mapping.stateless;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Paper {
+ private Integer id;
+ private String color;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,44 @@
+<?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.stats">
+
+ <import class="Locality"/>
+
+ <class name="Continent">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <set name="countries">
+ <key column="country_id"/>
+ <one-to-many class="Country"/>
+ </set>
+ </class>
+
+ <class name="Country">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class name="State">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <many-to-one name="country"/>
+ </class>
+
+ <class name="Province">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <many-to-one name="country"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,38 @@
+//$Id: Continent.java 6736 2005-05-09 16:09:38Z epbernard $
+package mapping.stats;
+
+import java.util.Set;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Continent {
+ private Integer id;
+ private String name;
+ private Set countries;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getCountries() {
+ return countries;
+ }
+
+ public void setCountries(Set countries) {
+ this.countries = countries;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent2.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent2.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Continent2.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,25 @@
+<?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.stats">
+
+ <class name="Continent" table="tbl_continent">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <set name="countries">
+ <key column="country_id"/>
+ <one-to-many class="Country"/>
+ </set>
+ </class>
+
+ <class name="Country" table="tbl_country">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ </class>
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Country.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Country.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Country.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,41 @@
+//$Id: Country.java 6736 2005-05-09 16:09:38Z epbernard $
+package mapping.stats;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Country {
+ private Integer id;
+ private String name;
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Country)) return false;
+
+ final Country country = (Country) o;
+
+ if (!name.equals(country.name)) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Locality.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Locality.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Locality.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,42 @@
+package mapping.stats;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Locality {
+ private Long id;
+ private String name;
+ private Country country;
+
+ public Locality() {
+ }
+
+ public Locality(String name, Country country) {
+ this.name = name;
+ this.country = country;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ this.country = country;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Province.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Province.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/Province.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,7 @@
+package mapping.stats;
+
+/**
+ * @author Steve Ebersole
+ */
+public class Province extends Locality {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/State.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/State.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/stats/State.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,7 @@
+package mapping.stats;
+
+/**
+ * @author Steve Ebersole
+ */
+public class State extends Locality {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Customer.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Customer.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Customer.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,26 @@
+// $Id: Customer.java 5899 2005-02-24 20:08:04Z steveebersole $
+package mapping.subclassfilter;
+
+/**
+ * Implementation of Customer.
+ *
+ * @author Steve Ebersole
+ */
+public class Customer extends Person {
+ private Employee contactOwner;
+
+ public Customer() {
+ }
+
+ public Customer(String name) {
+ super( name );
+ }
+
+ public Employee getContactOwner() {
+ return contactOwner;
+ }
+
+ public void setContactOwner(Employee contactOwner) {
+ this.contactOwner = contactOwner;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Employee.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Employee.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Employee.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,56 @@
+// $Id: Employee.java 5899 2005-02-24 20:08:04Z steveebersole $
+package mapping.subclassfilter;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Implementation of Employee.
+ *
+ * @author Steve Ebersole
+ */
+public class Employee extends Person {
+ private String title;
+ private String department;
+ private Employee manager;
+ private Set minions = new HashSet();
+
+ public Employee() {
+ }
+
+ public Employee(String name) {
+ super( name );
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getDepartment() {
+ return department;
+ }
+
+ public void setDepartment(String department) {
+ this.department = department;
+ }
+
+ public Employee getManager() {
+ return manager;
+ }
+
+ public void setManager(Employee manager) {
+ this.manager = manager;
+ }
+
+ public Set getMinions() {
+ return minions;
+ }
+
+ public void setMinions(Set minions) {
+ this.minions = minions;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Person.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Person.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/Person.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,53 @@
+// $Id: Person.java 5899 2005-02-24 20:08:04Z steveebersole $
+package mapping.subclassfilter;
+
+/**
+ * Implementation of Person.
+ *
+ * @author Steve Ebersole
+ */
+public class Person {
+ private Long id;
+ private String name;
+ private String company;
+ private String region;
+
+ public Person() {
+ }
+
+ public Person(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/discrim-subclass.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/discrim-subclass.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/discrim-subclass.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,44 @@
+<?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.subclassfilter">
+
+ <class name="Person" discriminator-value="0"
table="SPerson">
+
+ <id name="id" column="person_id">
+ <generator class="native"/>
+ </id>
+
+ <discriminator type="int"
+ formula="CASE WHEN company is null THEN 0 WHEN company = 'JBoss' THEN 1
ELSE 2 END"/>
+
+ <property name="name"/>
+ <property name="company"/>
+ <property name="region"/>
+
+ <subclass name="Employee" discriminator-value="1">
+ <property name="title"/>
+ <property name="department" column="dept"/>
+ <many-to-one name="manager" column="mgr_id"
class="Employee" cascade="none"/>
+ <set name="minions" inverse="true" lazy="true"
cascade="all">
+ <key column="mgr_id"/>
+ <one-to-many class="Employee"/>
+ <filter name="region" condition="region = :userRegion"/>
+ </set>
+ </subclass>
+
+ <subclass name="Customer" discriminator-value="2">
+ <many-to-one name="contactOwner" class="Employee"/>
+ </subclass>
+
+ <filter name="region" condition="region = :userRegion"/>
+
+ </class>
+
+ <filter-def name="region">
+ <filter-param name="userRegion" type="string"/>
+ </filter-def>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/joined-subclass.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/joined-subclass.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/joined-subclass.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,43 @@
+<?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.subclassfilter">
+
+ <class name="Person" table="JPerson">
+
+ <id name="id" column="person_id">
+ <generator class="native"/>
+ </id>
+
+ <property name="name"/>
+ <property name="company"/>
+ <property name="region"/>
+
+ <joined-subclass name="Employee" table="JEmployee">
+ <key column="person_id"/>
+
+ <property name="title"/>
+ <property name="department" column="dept"/>
+ <many-to-one name="manager" class="Employee"
column="mgr_id" cascade="none"/>
+ <set name="minions" inverse="true" cascade="all"
lazy="true">
+ <key column="mgr_id"/>
+ <one-to-many class="Employee"/>
+ </set>
+ </joined-subclass>
+
+ <joined-subclass name="Customer" table="JCustomer">
+ <key column="person_id"/>
+
+ <many-to-one name="contactOwner" class="Employee"/>
+ </joined-subclass>
+
+ <filter name="region" condition="region = :userRegion"/>
+ </class>
+
+ <filter-def name="region">
+ <filter-param name="userRegion" type="string"/>
+ </filter-def>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/union-subclass.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/union-subclass.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subclassfilter/union-subclass.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,41 @@
+<?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.subclassfilter">
+
+ <class name="Person" table="UPerson">
+
+ <id name="id" column="person_id">
+ <generator class="hilo"/>
+ </id>
+
+ <property name="name" unique="true"/>
+ <property name="company"/>
+ <property name="region"/>
+
+ <union-subclass name="Employee" table="UEmployee">
+ <property name="title"/>
+ <property name="department" column="dept"/>
+ <many-to-one name="manager" column="mgr_id"
class="Employee" cascade="none"/>
+ <set name="minions" inverse="true" lazy="true"
cascade="all">
+ <key column="mgr_id"/>
+ <one-to-many class="Employee"/>
+ <filter name="region" condition="region = :userRegion"/>
+ </set>
+ </union-subclass>
+
+ <union-subclass name="Customer" table="UCustomer">
+ <many-to-one name="contactOwner" class="Employee"/>
+ </union-subclass>
+
+ <filter name="region" condition="region = :userRegion"/>
+
+ </class>
+
+ <filter-def name="region">
+ <filter-param name="userRegion" type="string"/>
+ </filter-def>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Alien.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Alien.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Alien.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,37 @@
+//$Id: Alien.java 7203 2005-06-19 02:01:05Z oneovthafew $
+package mapping.subselect;
+
+/**
+ * @author Gavin King
+ */
+public class Alien {
+ private Long id;
+ private String identity;
+ private String planet;
+ private String species;
+
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+ public String getIdentity() {
+ return identity;
+ }
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+ public String getSpecies() {
+ return species;
+ }
+ public void setPlanet(String planet) {
+ this.planet = planet;
+ }
+ public String getPlanet() {
+ return planet;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public Long getId() {
+ return id;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Being.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Being.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Being.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,31 @@
+//$Id: Being.java 7203 2005-06-19 02:01:05Z oneovthafew $
+package mapping.subselect;
+
+/**
+ * @author Gavin King
+ */
+public class Being {
+ private long id;
+ private String identity;
+ private String location;
+ private String species;
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+ public String getLocation() {
+ return location;
+ }
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+ public String getSpecies() {
+ return species;
+ }
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+ public String getIdentity() {
+ return identity;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Beings.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Beings.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Beings.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+ (1) use of a class-to-subselect mapping, that allows data
+ defined in other classes to be exposed as a read-only
+ entity (you would do this if you really wanted a view,
+ but didn't or couldn't define one for some reason)
+ This is a "derived entity" mapping.
+
+ (2) use of <synchronize/> to ensure that auto-flush happens
+ correctly, and that queries against the derived entity
+ do not return stale data
+
+-->
+
+<hibernate-mapping
+ package="mapping.subselect"
+ default-access="field">
+
+ <class name="Human" table="humans">
+
+ <id name="id" unsaved-value="0"
+ column="bid">
+ <generator class="hilo"/>
+ </id>
+
+ <property name="name"
+ not-null="true"/>
+ <property name="sex"
+ not-null="true"
+ update="false"/>
+ <property name="address"/>
+
+ </class>
+
+ <class name="Alien" table="aliens">
+
+ <id name="id" unsaved-value="0"
+ column="bid">
+ <generator class="hilo"/>
+ </id>
+
+ <property name="identity"
+ not-null="true"
+ column="ident"/>
+ <property name="planet"/>
+ <property name="species"
+ not-null="true"
+ update="false"/>
+
+ </class>
+
+ <class name="Being" mutable="false">
+
+ <subselect>
+ select bid, name as ident, address as loc, 'human' as species
+ from humans
+ union
+ select bid, ident, planet as loc, species
+ from aliens
+ </subselect>
+
+ <synchronize table="humans"/>
+ <synchronize table="aliens"/>
+
+ <id name="id" unsaved-value="0"
+ column="bid">
+ <generator class="native"/>
+ </id>
+
+ <property name="identity" column="ident"/>
+ <property name="location" column="loc"/>
+ <property name="species"/>
+
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Human.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Human.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselect/Human.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,37 @@
+//$Id: Human.java 7203 2005-06-19 02:01:05Z oneovthafew $
+package mapping.subselect;
+
+/**
+ * @author Gavin King
+ */
+public class Human {
+ private Long id;
+ private String name;
+ private char sex;
+ private String address;
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+ public String getAddress() {
+ return address;
+ }
+ public void setSex(char sex) {
+ this.sex = sex;
+ }
+ public char getSex() {
+ return sex;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public Long getId() {
+ return id;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Child.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Child.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Child.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,34 @@
+//$Id: Child.java 6095 2005-03-17 05:57:29Z oneovthafew $
+package mapping.subselectfetch;
+
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class Child {
+ private String name;
+ private List friends;
+
+ Child() {}
+ public Child(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ public List getFriends() {
+ return friends;
+ }
+
+ public void setFriends(List friends) {
+ this.friends = friends;
+ }
+
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Parent.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Parent.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/Parent.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,45 @@
+//$Id: Parent.java 6095 2005-03-17 05:57:29Z oneovthafew $
+package mapping.subselectfetch;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class Parent {
+ private String name;
+ private List children = new ArrayList();
+ private List moreChildren = new ArrayList();
+
+ Parent() {}
+ public Parent(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List getChildren() {
+ return children;
+ }
+
+ public void setChildren(List children) {
+ this.children = children;
+ }
+
+ public List getMoreChildren() {
+ return moreChildren;
+ }
+
+ public void setMoreChildren(List moreChildren) {
+ this.moreChildren = moreChildren;
+ }
+
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/ParentChild.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/ParentChild.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/subselectfetch/ParentChild.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.subselectfetch">
+
+ <class name="Child">
+ <id name="name"/>
+ <bag name="friends" fetch="subselect"
table="ChildChild">
+ <key column="childName1" not-null="true"/>
+ <many-to-many class="Child" column="childName2"/>
+ </bag>
+ </class>
+
+ <class name="Parent">
+ <id name="name"/>
+ <list name="children" fetch="subselect" cascade="persist,
delete">
+ <key column="parentName" not-null="true"/>
+ <list-index column="loc"/>
+ <one-to-many class="Child"/>
+ </list>
+ <list name="moreChildren" table="ParentChild"
fetch="subselect">
+ <key column="parentName" not-null="true"/>
+ <list-index column="loc"/>
+ <many-to-many class="Child" column="childName"/>
+ </list>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Employee.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Employee.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Employee.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,47 @@
+//$Id: Employee.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.ternary;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class Employee {
+ private String name;
+ private Date hireDate;
+ private Map managerBySite = new HashMap();
+ private Set underlings = new HashSet();
+
+ Employee() {}
+ public Employee(String name) {
+ this.name=name;
+ }
+ public Map getManagerBySite() {
+ return managerBySite;
+ }
+ public void setManagerBySite(Map managerBySite) {
+ this.managerBySite = managerBySite;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Set getUnderlings() {
+ return underlings;
+ }
+ public void setUnderlings(Set underlings) {
+ this.underlings = underlings;
+ }
+ public Date getHireDate() {
+ return hireDate;
+ }
+ public void setHireDate(Date hireDate) {
+ this.hireDate = hireDate;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Site.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Site.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Site.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,44 @@
+//$Id: Site.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.ternary;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class Site {
+ private String name;
+ private String description;
+ private Set employees = new HashSet();
+ private Set managers = new HashSet();
+
+ Site() {}
+ public Site(String name) {
+ this.name=name;
+ }
+ public Set getManagers() {
+ return managers;
+ }
+ public void setManagers(Set managers) {
+ this.managers = managers;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public Set getEmployees() {
+ return employees;
+ }
+ public void setEmployees(Set employees) {
+ this.employees = employees;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Ternary.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Ternary.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ternary/Ternary.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,36 @@
+<?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.ternary">
+
+ <class name="Employee">
+ <id name="name"/>
+ <property name="hireDate" type="imm_date"/>
+ <map name="managerBySite" table="employeeSite">
+ <key column="employeeName" not-null="true"/>
+ <map-key-many-to-many column="siteName" class="Site"/>
+ <many-to-many column="managerName" class="Employee"/>
+ </map>
+ <set name="underlings" table="employeeSite"
inverse="true">
+ <key column="managerName" not-null="true"/>
+ <many-to-many column="employeeName" class="Employee"/>
+ </set>
+ </class>
+
+ <class name="Site">
+ <id name="name"/>
+ <property name="description"/>
+ <set name="employees" table="employeeSite"
inverse="true">
+ <key column="siteName"/>
+ <many-to-many column="employeeName" class="Employee"/>
+ </set>
+ <set name="managers" table="employeeSite"
inverse="true">
+ <key column="siteName"/>
+ <many-to-many column="managerName" class="Employee"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/Person.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/Person.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/Person.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,37 @@
+//$Id: Person.java 8054 2005-08-31 20:12:24Z oneovthafew $
+package mapping.timestamp;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+ private String name;
+ private Date dob;
+ private String currentAddress;
+ Person() {}
+ public Person(String name, Date dob, String address) {
+ this.name = name;
+ this.dob = dob;
+ this.currentAddress = address;
+ }
+ public Date getDob() {
+ return dob;
+ }
+ public void setDob(Date dob) {
+ this.dob = dob;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getCurrentAddress() {
+ return currentAddress;
+ }
+ public void setCurrentAddress(String currentAddress) {
+ this.currentAddress = currentAddress;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -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.timestamp">
+
+ <class name="User" table="T_USER"
dynamic-update="true">
+ <id name="userName"/>
+ <timestamp name="lastModified"/>
+ <property name="password" not-null="true"
optimistic-lock="false"/>
+ <component name="person">
+ <property name="name" update="false"
not-null="true"/>
+ <property name="dob" update="false"
not-null="true"/>
+ <property name="currentAddress"
+ column="address"
+ insert="false"
+ update="false"/>
+ </component>
+ </class>
+
+ <query name="userNameIn"><![CDATA[from User where person.name in
(:nameList) or userName in (:nameList)]]></query>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/timestamp/User.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,44 @@
+//$Id: User.java 8054 2005-08-31 20:12:24Z oneovthafew $
+package mapping.timestamp;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String userName;
+ private String password;
+ private Person person;
+ private Date lastModified;
+ User() {}
+ public User(String id, String pw, Person person) {
+ this.userName = id;
+ this.password = pw;
+ this.person = person;
+ }
+ public Date getLastModified() {
+ return lastModified;
+ }
+ public void setLastModified(Date lastModified) {
+ this.lastModified = lastModified;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tm/Item.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tm/Item.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tm/Item.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,17 @@
+<?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.tm">
+
+ <class entity-name="Item" table="Things">
+ <id name="name" type="string"/>
+ <property name="description" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.tool">
+ <class name="Team" table="`Team`">
+ <id name="id" column="`iD`">
+ <generator class="native">
+ <param name="sequence">TEAM_SEQ</param>
+ </generator>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class entity-name="OtherTeam" name="Team"
table="TEAM">
+ <id name="id" column="id">
+ <generator class="native">
+ <param name="sequence">TEAM_SEQ</param>
+ </generator>
+ </id>
+ <property name="name" column="xname"/>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/tool/Team.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,20 @@
+package mapping.tool;
+
+
+public class Team {
+ private Long id;
+ private String name;
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Address.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Address.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Address.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,55 @@
+//$Id: Address.java 6979 2005-06-01 03:51:32Z oneovthafew $
+package mapping.typedmanytoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Address implements Serializable {
+
+ private AddressId addressId;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+ private Customer customer;
+
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public String getCity() {
+ return city;
+ }
+ public void setCity(String city) {
+ this.city = city;
+ }
+ public String getState() {
+ return state;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+ public String getStreet() {
+ return street;
+ }
+ public void setStreet(String street) {
+ this.street = street;
+ }
+ public String getZip() {
+ return zip;
+ }
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+ public AddressId getAddressId() {
+ return addressId;
+ }
+ public void setAddressId(AddressId addressId) {
+ this.addressId = addressId;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/AddressId.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/AddressId.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/AddressId.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,45 @@
+//$Id: AddressId.java 6979 2005-06-01 03:51:32Z oneovthafew $
+package mapping.typedmanytoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class AddressId implements Serializable {
+ private String type;
+ private String addressId;
+
+ public AddressId(String type, String customerId) {
+ this.addressId = customerId;
+ this.type = type;
+ }
+
+ public AddressId() {}
+
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getAddressId() {
+ return addressId;
+ }
+ public void setAddressId(String customerId) {
+ this.addressId = customerId;
+ }
+ public boolean equals(Object other) {
+ if ( !(other instanceof AddressId) ) return false;
+ AddressId add = (AddressId) other;
+ return type.equals(add.type) && addressId.equals(add.addressId);
+ }
+ public int hashCode() {
+ return addressId.hashCode() + type.hashCode();
+ }
+
+ public String toString() {
+ return type + '#' + addressId;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Shows how to map a one-to-many relationship in the relational
+ schema to "typed" one-to-one associations in the object model.
+ We map the Address class twice, with different entity names,
+ specifying a filtering condition in each mapping. The typed
+ associations then reference the named entities.
+
+-->
+
+<hibernate-mapping package="mapping.typedmanytoone">
+
+ <class name="Customer"
+ select-before-update="true"
+ dynamic-update="true">
+
+ <id name="customerId">
+ <generator class="assigned"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+
+ <many-to-one name="billingAddress"
+ entity-name="BillingAddress"
+ cascade="persist,save-update,delete"
+ fetch="join">
+ <column name="billingAddressId"/>
+ <formula>'BILLING'</formula>
+ </many-to-one>
+
+ <many-to-one name="shippingAddress"
+ entity-name="ShippingAddress"
+ cascade="persist,save-update,delete"
+ fetch="join">
+ <column name="shippingAddressId"/>
+ <formula>'SHIPPING'</formula>
+ </many-to-one>
+
+ </class>
+
+ <class name="Address"
+ table="Address"
+ entity-name="BillingAddress"
+ where="type='BILLING'"
+ check="type in ('BILLING', 'SHIPPING')"
+ select-before-update="true"
+ dynamic-update="true">
+
+ <composite-id name="addressId">
+ <key-property name="addressId"/>
+ <key-property name="type"/>
+ </composite-id>
+
+ <property name="street" not-null="true"/>
+ <property name="city" not-null="true"/>
+ <property name="state" not-null="true"/>
+ <property name="zip" not-null="true"/>
+
+ </class>
+
+ <class name="Address"
+ table="Address"
+ entity-name="ShippingAddress"
+ where="type='SHIPPING'"
+ select-before-update="true"
+ dynamic-update="true">
+
+ <composite-id name="addressId">
+ <key-property name="addressId"/>
+ <key-property name="type"/>
+ </composite-id>
+
+ <property name="street" not-null="true"/>
+ <property name="city" not-null="true"/>
+ <property name="state" not-null="true"/>
+ <property name="zip" not-null="true"/>
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedmanytoone/Customer.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,40 @@
+//$Id: Customer.java 6979 2005-06-01 03:51:32Z oneovthafew $
+package mapping.typedmanytoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Customer implements Serializable {
+
+ private String name;
+ private String customerId;
+ private Address billingAddress;
+ private Address shippingAddress;
+
+ public Address getBillingAddress() {
+ return billingAddress;
+ }
+ public void setBillingAddress(Address billingAddress) {
+ this.billingAddress = billingAddress;
+ }
+ public String getCustomerId() {
+ return customerId;
+ }
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Address getShippingAddress() {
+ return shippingAddress;
+ }
+ public void setShippingAddress(Address shippingAddress) {
+ this.shippingAddress = shippingAddress;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Address.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Address.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Address.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,55 @@
+//$Id: Address.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.typedonetoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Address implements Serializable {
+
+ private AddressId addressId;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+ private Customer customer;
+
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public String getCity() {
+ return city;
+ }
+ public void setCity(String city) {
+ this.city = city;
+ }
+ public String getState() {
+ return state;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+ public String getStreet() {
+ return street;
+ }
+ public void setStreet(String street) {
+ this.street = street;
+ }
+ public String getZip() {
+ return zip;
+ }
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+ public AddressId getAddressId() {
+ return addressId;
+ }
+ public void setAddressId(AddressId addressId) {
+ this.addressId = addressId;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/AddressId.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/AddressId.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/AddressId.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,41 @@
+//$Id: AddressId.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.typedonetoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class AddressId implements Serializable {
+ private String type;
+ private String customerId;
+
+ public AddressId(String type, String customerId) {
+ this.customerId = customerId;
+ this.type = type;
+ }
+
+ public AddressId() {}
+
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getCustomerId() {
+ return customerId;
+ }
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+ public boolean equals(Object other) {
+ if ( !(other instanceof AddressId) ) return false;
+ AddressId add = (AddressId) other;
+ return type.equals(add.type) && customerId.equals(add.customerId);
+ }
+ public int hashCode() {
+ return customerId.hashCode() + type.hashCode();
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.hbm.xml 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Shows how to map a one-to-many relationship in the relational
+ schema to "typed" one-to-one associations in the object model.
+ We map the Address class twice, with different entity names,
+ specifying a filtering condition in each mapping. The typed
+ associations then reference the named entities.
+
+-->
+
+<hibernate-mapping package="mapping.typedonetoone">
+
+ <class name="Customer">
+
+ <id name="customerId">
+ <generator class="assigned"/>
+ </id>
+
+ <property name="name" not-null="true"/>
+
+ <one-to-one name="billingAddress"
+ entity-name="BillingAddress"
+ property-ref="customer"
+ cascade="persist, delete"
+ fetch="join"/>
+
+ <one-to-one name="shippingAddress"
+ entity-name="ShippingAddress"
+ property-ref="customer"
+ cascade="persist, delete"
+ fetch="join"/>
+
+ </class>
+
+ <class name="Address"
+ table="Address"
+ entity-name="BillingAddress"
+ where="type='BILLING'"
+ check="type in ('BILLING', 'SHIPPING')">
+
+ <composite-id name="addressId">
+ <key-property name="customerId"/>
+ <key-property name="type"/>
+ </composite-id>
+
+ <property name="street" not-null="true"/>
+ <property name="city" not-null="true"/>
+ <property name="state" not-null="true"/>
+ <property name="zip" not-null="true"/>
+
+ <many-to-one name="customer"
+ column="customerId"
+ insert="false"
+ update="false"/>
+
+ </class>
+
+ <class name="Address"
+ table="Address"
+ entity-name="ShippingAddress"
+ where="type='SHIPPING'">
+
+ <composite-id name="addressId">
+ <key-property name="customerId"/>
+ <key-property name="type"/>
+ </composite-id>
+
+ <property name="street" not-null="true"/>
+ <property name="city" not-null="true"/>
+ <property name="state" not-null="true"/>
+ <property name="zip" not-null="true"/>
+
+ <many-to-one name="customer"
+ column="customerId"
+ insert="false"
+ update="false"/>
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typedonetoone/Customer.java 2007-07-31
17:06:06 UTC (rev 2774)
@@ -0,0 +1,40 @@
+//$Id: Customer.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.typedonetoone;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Customer implements Serializable {
+
+ private String name;
+ private String customerId;
+ private Address billingAddress;
+ private Address shippingAddress;
+
+ public Address getBillingAddress() {
+ return billingAddress;
+ }
+ public void setBillingAddress(Address billingAddress) {
+ this.billingAddress = billingAddress;
+ }
+ public String getCustomerId() {
+ return customerId;
+ }
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Address getShippingAddress() {
+ return shippingAddress;
+ }
+ public void setShippingAddress(Address shippingAddress) {
+ this.shippingAddress = shippingAddress;
+ }
+}