Author: mdryakhlenkov
Date: 2007-07-17 12:34:59 -0400 (Tue, 17 Jul 2007)
New Revision: 2481
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Car.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Cat.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Classification.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ClassificationType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyCompositeKey.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyIdFieldNames.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Dog.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/DomesticAnimal.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/FooBarCopy.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/HeresAnotherCrazyIdFieldName.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Human.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/IntegerVersioned.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Joiner.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneKeyEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Lizard.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Mammal.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/MoreCrazyIdFieldNameStuffEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Name.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/PettingZoo.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Pickup.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Reptile.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SUV.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleAssociatedEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/StateProvince.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/TimestampVersioned.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Truck.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Versions.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Zoo.java
Log:
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Address.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Address.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Address.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,55 @@
+// $Id: Address.java 7996 2005-08-22 14:49:57Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Address.
+ *
+ * @author Steve Ebersole
+ */
+public class Address {
+ private String street;
+ private String city;
+ private String postalCode;
+ private String country;
+ private StateProvince stateProvince;
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public StateProvince getStateProvince() {
+ return stateProvince;
+ }
+
+ public void setStateProvince(StateProvince stateProvince) {
+ this.stateProvince = stateProvince;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,150 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+<hibernate-mapping
+ package="mapping.hql"
+ default-access="field">
+
+ <class name="Animal">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="description"/>
+ <property name="bodyWeight" column="body_weight"/>
+ <many-to-one name="mother" column="mother_id"/>
+ <many-to-one name="father" column="father_id"/>
+ <many-to-one name="zoo" column="zoo_id"/>
+ <property name="serialNumber"/>
+ <set name="offspring" order-by="father_id">
+ <key column="mother_id"/>
+ <one-to-many class="Animal"/>
+ </set>
+ <joined-subclass name="Reptile">
+ <key column="animal"/>
+ <property name="bodyTemperature"/>
+ <joined-subclass name="Lizard">
+ <key column="reptile"/>
+ </joined-subclass>
+ </joined-subclass>
+ <joined-subclass name="Mammal">
+ <key column="animal"/>
+ <property name="pregnant"/>
+ <property name="birthdate" type="date"/>
+ <joined-subclass name="DomesticAnimal">
+ <key column="mammal"/>
+ <many-to-one name="owner"/>
+ <joined-subclass name="Cat">
+ <key column="mammal"/>
+ </joined-subclass>
+ <joined-subclass name="Dog">
+ <key column="mammal"/>
+ </joined-subclass>
+ </joined-subclass>
+ <joined-subclass name="Human">
+ <key column="mammal"/>
+ <component name="name">
+ <property name="first" column="name_first"/>
+ <property name="initial" column="name_initial"/>
+ <property name="last" column="name_last"/>
+ </component>
+ <property name="nickName"/>
+ <property name="height"/>
+
+ <property name="intValue"/>
+ <property name="floatValue"/>
+ <property name="bigDecimalValue"/>
+ <property name="bigIntegerValue"/>
+
+ <bag name="friends">
+ <key column="human1"/>
+ <many-to-many column="human2" class="Human"/>
+ </bag>
+ <map name="family">
+ <key column="human1"/>
+ <map-key column="relationship" type="string"/>
+ <many-to-many column="human2" class="Human"/>
+ </map>
+ <bag name="pets" inverse="true">
+ <key column="owner"/>
+ <one-to-many class="DomesticAnimal"/>
+ </bag>
+ <set name="nickNames" lazy="false"
table="human_nick_names" sort="natural">
+ <key column="human"/>
+ <element column="nick_name" type="string"
not-null="true"/>
+ </set>
+ <map name="addresses" table="addresses">
+ <key column="human"/>
+ <map-key type="string" column="type"/>
+ <composite-element class="Address">
+ <property name="street"/>
+ <property name="city"/>
+ <property name="postalCode"/>
+ <property name="country"/>
+ <many-to-one name="stateProvince"
column="state_prov_id" class="StateProvince"/>
+ </composite-element>
+ </map>
+ </joined-subclass>
+ </joined-subclass>
+ </class>
+
+ <class name="User" table="`User`">
+ <id name="id">
+ <generator class="foreign">
+ <param name="property">human</param>
+ </generator>
+ </id>
+ <property name="userName"/>
+ <one-to-one name="human" constrained="true"/>
+ <list name="permissions">
+ <key column="userId"/>
+ <list-index column="permissionId"/>
+ <element type="string" column="permissionName"/>
+ </list>
+ </class>
+
+ <class name="Zoo" discriminator-value="Z">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <discriminator column="zooType" type="character"/>
+ <property name="name" type="string"/>
+ <property name="classification"
type="mapping.hql.ClassificationType"/>
+ <map name="mammals">
+ <key column="mammalZoo_id"/>
+ <index type="string" column="name"/>
+ <one-to-many class="Mammal"/>
+ </map>
+ <map name="animals" inverse="true">
+ <key column="zoo_id"/>
+ <index type="string" column="serialNumber"/>
+ <one-to-many class="Animal"/>
+ </map>
+ <component name="address" class="Address">
+ <property name="street"/>
+ <property name="city"/>
+ <property name="postalCode"/>
+ <property name="country"/>
+ <many-to-one name="stateProvince"
column="state_prov_id" class="StateProvince"/>
+ </component>
+ <subclass name="PettingZoo" discriminator-value="P"/>
+ </class>
+
+ <class name="StateProvince">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <property name="isoCode"/>
+ </class>
+
+ <class name="Joiner">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ <join table="JOINED">
+ <key column="ID"/>
+ <property name="joinedName"/>
+ </join>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Animal.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,99 @@
+//$Id: Animal.java 7445 2005-07-10 16:51:17Z oneovthafew $
+package mapping.hql;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Gavin King
+ */
+public class Animal {
+ private Long id;
+ private float bodyWeight;
+ private Set offspring;
+ private Animal mother;
+ private Animal father;
+ private String description;
+ private Zoo zoo;
+ private String serialNumber;
+
+ public Animal() {
+ }
+
+ public Animal(String description, float bodyWeight) {
+ this.description = description;
+ this.bodyWeight = bodyWeight;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public float getBodyWeight() {
+ return bodyWeight;
+ }
+
+ public void setBodyWeight(float bodyWeight) {
+ this.bodyWeight = bodyWeight;
+ }
+
+ public Set getOffspring() {
+ return offspring;
+ }
+
+ public void addOffspring(Animal offspring) {
+ if ( this.offspring == null ) {
+ this.offspring = new HashSet();
+ }
+
+ this.offspring.add( offspring );
+ }
+
+ public void setOffspring(Set offspring) {
+ this.offspring = offspring;
+ }
+
+ public Animal getMother() {
+ return mother;
+ }
+
+ public void setMother(Animal mother) {
+ this.mother = mother;
+ }
+
+ public Animal getFather() {
+ return father;
+ }
+
+ public void setFather(Animal father) {
+ this.father = father;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Zoo getZoo() {
+ return zoo;
+ }
+
+ public void setZoo(Zoo zoo) {
+ this.zoo = zoo;
+ }
+
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ public void setSerialNumber(String serialNumber) {
+ this.serialNumber = serialNumber;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql"
default-access="field">
+
+ <class name="BooleanLiteralEntity">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="yesNoBoolean" column="Y_N_BOOL"
type="yes_no"/>
+ <property name="trueFalseBoolean" column="T_F_BOOL"
type="true_false"/>
+ <property name="zeroOneBoolean" column="NUM_BOOL"
type="boolean"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/BooleanLiteralEntity.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,45 @@
+package mapping.hql;
+
+/**
+ * todo: describe BooleanLiteralEntity
+ *
+ * @author Steve Ebersole
+ */
+public class BooleanLiteralEntity {
+ private Long id;
+ private boolean yesNoBoolean;
+ private boolean trueFalseBoolean;
+ private boolean zeroOneBoolean;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public boolean isYesNoBoolean() {
+ return yesNoBoolean;
+ }
+
+ public void setYesNoBoolean(boolean yesNoBoolean) {
+ this.yesNoBoolean = yesNoBoolean;
+ }
+
+ public boolean isTrueFalseBoolean() {
+ return trueFalseBoolean;
+ }
+
+ public void setTrueFalseBoolean(boolean trueFalseBoolean) {
+ this.trueFalseBoolean = trueFalseBoolean;
+ }
+
+ public boolean isZeroOneBoolean() {
+ return zeroOneBoolean;
+ }
+
+ public void setZeroOneBoolean(boolean zeroOneBoolean) {
+ this.zeroOneBoolean = zeroOneBoolean;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Car.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Car.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Car.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,10 @@
+// $Id: Car.java 7087 2005-06-08 18:23:44Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Car.
+ *
+ * @author Steve Ebersole
+ */
+public class Car extends Vehicle {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Cat.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Cat.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Cat.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,9 @@
+//$Id: Cat.java 4476 2004-09-02 02:28:13Z oneovthafew $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class Cat extends DomesticAnimal {
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Classification.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Classification.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Classification.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,78 @@
+package mapping.hql;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+/**
+ * Mimic a JDK 5 enum.
+ *
+ * @author Steve Ebersole
+ */
+public class Classification implements Serializable, Comparable {
+
+ public static final Classification COOL = new Classification( "COOL", 0 );
+ public static final Classification LAME = new Classification( "LAME", 1 );
+
+ private static final HashMap INSTANCES = new HashMap();
+ static {
+ INSTANCES.put( COOL.name, COOL );
+ INSTANCES.put( LAME.name, LAME );
+ }
+
+ private final String name;
+ private final int ordinal;
+ private final int hashCode;
+
+ private Classification(String name, int ordinal) {
+ this.name = name;
+ this.ordinal = ordinal;
+
+ int hashCode = name.hashCode();
+ hashCode = 29 * hashCode + ordinal;
+ this.hashCode = hashCode;
+ }
+
+ public String name() {
+ return name;
+ }
+
+ public int ordinal() {
+ return ordinal;
+ }
+
+ public boolean equals(Object obj) {
+ return compareTo( obj ) == 0;
+ }
+
+ public int compareTo(Object o) {
+ int otherOrdinal = ( ( Classification ) o ).ordinal;
+ if ( ordinal == otherOrdinal ) {
+ return 0;
+ }
+ else if ( ordinal > otherOrdinal ) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ public int hashCode() {
+ return hashCode;
+ }
+
+ public static Classification valueOf(String name) {
+ return ( Classification ) INSTANCES.get( name );
+ }
+
+ public static Classification valueOf(Integer ordinal) {
+ if ( ordinal == null ) {
+ return null;
+ }
+ switch ( ordinal.intValue() ) {
+ case 0: return COOL;
+ case 1: return LAME;
+ default: throw new IllegalArgumentException( "unknown classification ordinal
[" + ordinal + "]" );
+ }
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ClassificationType.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ClassificationType.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ClassificationType.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,101 @@
+package mapping.hql;
+
+import org.hibernate.usertype.EnhancedUserType;
+import org.hibernate.HibernateException;
+import org.hibernate.Hibernate;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+import java.sql.Types;
+import java.io.Serializable;
+
+/**
+ * A custom type for mapping {@link org.hibernate.test.hql.Classification} instances
+ * to the respective db column.
+ * </p>
+ * THis is largely intended to mimic JDK5 enum support in JPA. Here we are
+ * using the approach of storing the ordinal values, rather than the names.
+ *
+ * @author Steve Ebersole
+ */
+public class ClassificationType implements EnhancedUserType {
+
+ public int[] sqlTypes() {
+ return new int[] { Types.TINYINT };
+ }
+
+ public Class returnedClass() {
+ return Classification.class;
+ }
+
+ public boolean equals(Object x, Object y) throws HibernateException {
+ if ( x == null && y == null ) {
+ return false;
+ }
+ else if ( x != null ) {
+ return x.equals( y );
+ }
+ else {
+ return y.equals( x );
+ }
+ }
+
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws
HibernateException, SQLException {
+ Integer ordinal = ( Integer ) Hibernate.INTEGER.nullSafeGet( rs, names[0] );
+ return Classification.valueOf( ordinal );
+ }
+
+ public void nullSafeSet(PreparedStatement st, Object value, int index) throws
HibernateException, SQLException {
+ Integer ordinal = value == null ? null : new Integer( ( ( Classification ) value
).ordinal() );
+ Hibernate.INTEGER.nullSafeSet( st, ordinal, index );
+ }
+
+ public Object deepCopy(Object value) throws HibernateException {
+ return value;
+ }
+
+ public boolean isMutable() {
+ return false;
+ }
+
+ public Serializable disassemble(Object value) throws HibernateException {
+ return ( Classification ) value;
+ }
+
+ public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ return cached;
+ }
+
+ public Object replace(Object original, Object target, Object owner) throws
HibernateException {
+ return original;
+ }
+
+ public String objectToSQLString(Object value) {
+ return extractOrdinalString( value );
+ }
+
+ public String toXMLString(Object value) {
+ return extractName( value );
+ }
+
+ public Object fromXMLString(String xmlValue) {
+ return Classification.valueOf( xmlValue );
+ }
+
+ private String extractName(Object obj) {
+ return ( ( Classification ) obj ).name();
+ }
+
+ private int extractOrdinal(Object value) {
+ return ( ( Classification ) value ).ordinal();
+ }
+
+ private String extractOrdinalString(Object value) {
+ return Integer.toString( extractOrdinal( value ) );
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql"
default-access="field">
+
+ <class name="ComponentContainer" table="HQL_COMP_CONT">
+ <id name="id" type="long" column="ID">
+ <generator class="increment" />
+ </id>
+ <component name="address"
class="ComponentContainer$Address">
+ <property name="street" type="string"
column="STREET_ADDR" />
+ <property name="city" type="string"
column="CITY_ADDR" />
+ <property name="state" type="string"
column="STATE_ADDR" />
+ <component name="zip"
class="ComponentContainer$Address$Zip">
+ <property name="code" type="int"
column="ZIP_CODE_ADDR" />
+ <property name="plus4" type="int"
column="ZIP_PLUS4_ADDR" />
+ </component>
+ </component>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/ComponentContainer.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,107 @@
+package mapping.hql;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class ComponentContainer {
+
+ private Long id;
+ private ComponentContainer.Address address;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public ComponentContainer.Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(ComponentContainer.Address address) {
+ this.address = address;
+ }
+
+ public static class Address {
+ private String street;
+ private String city;
+ private String state;
+ private ComponentContainer.Address.Zip zip;
+
+ public Address() {
+ }
+
+ public Address(String street, String city, String state, ComponentContainer.Address.Zip
zip) {
+ this.street = street;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ 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 ComponentContainer.Address.Zip getZip() {
+ return zip;
+ }
+
+ public void setZip(ComponentContainer.Address.Zip zip) {
+ this.zip = zip;
+ }
+
+ public static class Zip {
+ private int code;
+ private int plus4;
+
+ public Zip() {
+ }
+
+ public Zip(int code, int plus4) {
+ this.code = code;
+ this.plus4 = plus4;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public int getPlus4() {
+ return plus4;
+ }
+
+ public void setPlus4(int plus4) {
+ this.plus4 = plus4;
+ }
+ }
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyCompositeKey.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyCompositeKey.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyCompositeKey.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,40 @@
+// $Id: CrazyCompositeKey.java 6970 2005-05-31 20:24:41Z oneovthafew $
+package mapping.hql;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of CrazyCompositeKey.
+ *
+ * @author Steve Ebersole
+ */
+public class CrazyCompositeKey implements Serializable {
+ private Long id;
+ private Long otherId;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getOtherId() {
+ return otherId;
+ }
+
+ public void setOtherId(Long otherId) {
+ this.otherId = otherId;
+ }
+
+ public boolean equals(Object that) {
+ CrazyCompositeKey cck = (CrazyCompositeKey) that;
+ return cck.id.longValue() == id.longValue()
+ && cck.otherId.longValue() == otherId.longValue();
+ }
+
+ public int hashCode() {
+ return id.hashCode() + otherId.hashCode();
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyIdFieldNames.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyIdFieldNames.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/CrazyIdFieldNames.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql">
+
+ <class name="HeresAnotherCrazyIdFieldName"
table="CRAZY_ID_NODE">
+ <id name="heresAnotherCrazyIdFieldName" column="ID"
type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+ <class name="MoreCrazyIdFieldNameStuffEntity"
table="CRAZY_ID_TOP">
+ <id name="moreCrazyIdFieldNameStuffEntity" column="ID"
type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="name" type="string" />
+ <many-to-one name="heresAnotherCrazyIdFieldName"
class="HeresAnotherCrazyIdFieldName"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Dog.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Dog.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Dog.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,9 @@
+//$Id: Dog.java 4476 2004-09-02 02:28:13Z oneovthafew $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class Dog extends DomesticAnimal {
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/DomesticAnimal.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/DomesticAnimal.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/DomesticAnimal.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,17 @@
+//$Id: DomesticAnimal.java 4899 2004-12-06 14:17:24Z pgmjsd $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class DomesticAnimal extends Mammal {
+ private Human owner;
+
+ public Human getOwner() {
+ return owner;
+ }
+
+ public void setOwner(Human owner) {
+ this.owner = owner;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql">
+
+ <class name="EntityWithCrazyCompositeKey">
+ <composite-id name="id" class="CrazyCompositeKey">
+ <key-property name="id" column="id"/>
+ <key-property name="otherId" column="other_id"/>
+ </composite-id>
+ <property name="name"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/EntityWithCrazyCompositeKey.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,28 @@
+// $Id: EntityWithCrazyCompositeKey.java 6567 2005-04-27 17:41:57Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of EntityWithCrazyCompositeKey.
+ *
+ * @author Steve Ebersole
+ */
+public class EntityWithCrazyCompositeKey {
+ private CrazyCompositeKey id;
+ private String name;
+
+ public CrazyCompositeKey getId() {
+ return id;
+ }
+
+ public void setId(CrazyCompositeKey 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/hql/FooBarCopy.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/FooBarCopy.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/FooBarCopy.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,137 @@
+<?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 default-lazy="false" package="mapping.hql">
+
+ <!-- a slightly modified copy of FooBar.hbm.xml from the legacy test package
-->
+
+ <class
+ name="Foo"
+ table="`foos`"
+ proxy="FooProxy"
+ discriminator-value="F"
+ batch-size="4"
+ dynamic-insert="true"
+ dynamic-update="true"
+ select-before-update="true">
+
+ <id name="key" type="string">
+ <column name="`foo_idcolumnname123`" length="36"/>
+ <generator class="uuid.hex">
+ <param name="seperator">:</param>
+ </generator>
+ </id>
+
+ <discriminator column="`foo_subclass_1234`" type="character"
force="true"/>
+ <version name="version"/>
+
+ <many-to-one name="foo" class="Foo">
+ <column name="foo" length="36"
index="fbmtoidx"/>
+ </many-to-one>
+
+ <property name="long">
+ <column name="long_" index="fbmtoidx"
unique-key="abc" not-null="true"/>
+ </property>
+ <property name="integer">
+ <column name="`integer__`" unique-key="abc"
not-null="true"/>
+ </property>
+ <property name="float">
+ <column name="float_" unique-key="abc"
not-null="true" check="float_ > 0.0"/>
+ </property>
+ <property name="x"/>
+ <property name="double" column="double_"/>
+
+ <primitive-array name="bytes" table="foobytes">
+ <key column="id"/>
+ <index column="i"/>
+ <element column="byte_" type="byte"/>
+ </primitive-array>
+
+ <property name="date" type="date" column="date_"/>
+ <property name="timestamp" type="timestamp"
column="timestamp_"/>
+ <property name="boolean" column="boolean_"/>
+ <property name="bool" column="bool_"/>
+ <property name="null" column="null_"/>
+ <property name="short" column="short_"/>
+ <property name="char" column="char_"/>
+ <property name="zero" column="zero_"/>
+ <property name="int" column="int_"/>
+ <property name="string">
+ <column name="string_" length="48"
index="fbstridx"/>
+ </property>
+ <property name="byte" column="byte_"/>
+ <property name="yesno" type="yes_no"/>
+ <property name="blob"
type="org.hibernate.test.legacy.Foo$Struct" column="blobb_"/>
+ <property name="nullBlob" type="serializable"/>
+ <property name="binary" column="bin_"/>
+ <property name="theLocale" access="field"
column="`localeayzabc123`"/>
+
+ <property name="formula" formula="int_/2"/>
+
+ <property name="custom"
type="org.hibernate.test.legacy.DoubleStringType" access="field">
+ <column name="first_name" length="66"/>
+ <column name="surname" length="66"/>
+ </property>
+ <component name="nullComponent">
+ <property name="name" column="null_cmpnt_"/>
+ </component>
+
+ <join table="jointable">
+ <key column="fooid" on-delete="cascade"/>
+ <property name="joinedProp"/>
+ </join>
+
+ <subclass
+ name="Trivial"
+ proxy="FooProxy"
+ discriminator-value="T"/>
+
+ <subclass
+ name="Abstract"
+ proxy="AbstractProxy"
+ discriminator-value="null">
+ <set name="abstracts" batch-size="2">
+ <key column="abstract_id"/>
+ <one-to-many class="Abstract"/>
+ </set>
+ <property name="time" column="the_time"/>
+
+ <subclass
+ name="Bar"
+ proxy="BarProxy"
+ discriminator-value="B">
+ <property name="barString">
+ <column name="bar_string" length="24"/>
+ </property>
+ <any name="object" meta-type="character"
id-type="long" cascade="all">
+ <meta-value value="O" class="One"/>
+ <meta-value value="M" class="Many"/>
+ <column name="clazz" length="100"/>
+ <column name="gen_id"/>
+ </any>
+ <join table="bar_join_table">
+ <key column="bar_id"/>
+ <property name="name" column="name_name"/>
+ </join>
+ </subclass>
+ </subclass>
+ </class>
+
+ <class name="One" table="one">
+ <id name="key" column="one_key">
+ <generator class="native" />
+ </id>
+ <property name="x"/>
+ <property column="one_value" name="value"/>
+ </class>
+
+ <class name="Many" table="many">
+ <id name="key" column="many_key">
+ <generator class="native" />
+ </id>
+ <property name="x"/>
+ </class>
+
+</hibernate-mapping>
+
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/HeresAnotherCrazyIdFieldName.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/HeresAnotherCrazyIdFieldName.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/HeresAnotherCrazyIdFieldName.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,35 @@
+// $Id: HeresAnotherCrazyIdFieldName.java 7471 2005-07-14 14:58:28Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of HeresAnotherCrazyIdFieldName.
+ *
+ * @author Steve Ebersole
+ */
+public class HeresAnotherCrazyIdFieldName {
+ private Long heresAnotherCrazyIdFieldName;
+ private String name;
+
+ public HeresAnotherCrazyIdFieldName() {
+ }
+
+ public HeresAnotherCrazyIdFieldName(String name) {
+ this.name = name;
+ }
+
+ public Long getHeresAnotherCrazyIdFieldName() {
+ return heresAnotherCrazyIdFieldName;
+ }
+
+ public void setHeresAnotherCrazyIdFieldName(Long heresAnotherCrazyIdFieldName) {
+ this.heresAnotherCrazyIdFieldName = heresAnotherCrazyIdFieldName;
+ }
+
+ 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/hql/Human.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Human.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Human.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,126 @@
+//$Id: Human.java 9873 2006-05-04 13:42:48Z max.andersen(a)jboss.com $
+package mapping.hql;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class Human extends Mammal {
+ private Name name;
+ private String nickName;
+ private Collection friends;
+ private Collection pets;
+ private Map family;
+ private double height;
+
+ private BigInteger bigIntegerValue;
+ private BigDecimal bigDecimalValue;
+ private int intValue;
+ private float floatValue;
+
+ private Set nickNames;
+ private Map addresses;
+
+ public Collection getFriends() {
+ return friends;
+ }
+
+ public void setFriends(Collection friends) {
+ this.friends = friends;
+ }
+
+ public Collection getPets() {
+ return pets;
+ }
+
+ public void setPets(Collection pets) {
+ this.pets = pets;
+ }
+
+ public Name getName() {
+ return name;
+ }
+
+ public void setName(Name name) {
+ this.name = name;
+ }
+
+ public String getNickName() {
+ return nickName;
+ }
+
+ public void setNickName(String nickName) {
+ this.nickName = nickName;
+ }
+
+ public double getHeight() {
+ return height;
+ }
+ public void setHeight(double height) {
+ this.height = height;
+ }
+
+ public Map getFamily() {
+ return family;
+ }
+
+
+ public void setFamily(Map family) {
+ this.family = family;
+ }
+
+ public Set getNickNames() {
+ return nickNames;
+ }
+
+ public void setNickNames(Set nickNames) {
+ this.nickNames = nickNames;
+ }
+
+ public Map getAddresses() {
+ return addresses;
+ }
+
+ public void setAddresses(Map addresses) {
+ this.addresses = addresses;
+ }
+
+ public BigDecimal getBigDecimalValue() {
+ return bigDecimalValue;
+ }
+
+ public void setBigDecimalValue(BigDecimal bigDecimalValue) {
+ this.bigDecimalValue = bigDecimalValue;
+ }
+
+ public BigInteger getBigIntegerValue() {
+ return bigIntegerValue;
+ }
+
+ public void setBigIntegerValue(BigInteger bigIntegerValue) {
+ this.bigIntegerValue = bigIntegerValue;
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public void setFloatValue(float floatValue) {
+ this.floatValue = floatValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/IntegerVersioned.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/IntegerVersioned.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/IntegerVersioned.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,36 @@
+// $Id: IntegerVersioned.java 7384 2005-07-06 17:04:45Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of IntegerVersioned.
+ *
+ * @author Steve Ebersole
+ */
+public class IntegerVersioned {
+ private Long id;
+ private int version = -1;
+ private String name;
+
+ public IntegerVersioned() {
+ }
+
+ public IntegerVersioned(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ 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/hql/Joiner.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Joiner.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Joiner.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,37 @@
+// $Id: Joiner.java 6021 2005-03-06 02:02:30Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Joiner.
+ *
+ * @author Steve Ebersole
+ */
+public class Joiner {
+ private Long id;
+ private String name;
+ private String joinedName;
+
+ 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 getJoinedName() {
+ return joinedName;
+ }
+
+ public void setJoinedName(String joinedName) {
+ this.joinedName = joinedName;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -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.hql">
+
+ <class name="KeyManyToOneKeyEntity">
+ <id name="id" type="long" access="field" >
+ <generator class="native"/>
+ </id>
+ <property name="name" type="string"/>
+ </class>
+
+ <class name="KeyManyToOneEntity">
+ <composite-id name="id" access="field"
class="KeyManyToOneEntity$Id" unsaved-value="undefined" >
+ <key-many-to-one name="key1" class="KeyManyToOneKeyEntity"
/>
+ <key-property name="key2" type="string"/>
+ </composite-id>
+ <property name="name" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneEntity.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,52 @@
+// $Id: KeyManyToOneEntity.java 7091 2005-06-08 19:31:26Z steveebersole $
+package mapping.hql;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of KeyManyToOneEntity.
+ *
+ * @author Steve Ebersole
+ */
+public class KeyManyToOneEntity {
+ private Id id;
+ private String name;
+
+ public KeyManyToOneEntity(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public static class Id implements Serializable {
+ private KeyManyToOneKeyEntity key1;
+ private String key2;
+
+ public Id(KeyManyToOneKeyEntity key1, String key2) {
+ this.key1 = key1;
+ this.key2 = key2;
+ }
+
+ public KeyManyToOneKeyEntity getKey1() {
+ return key1;
+ }
+
+ public void setKey1(KeyManyToOneKeyEntity key1) {
+ this.key1 = key1;
+ }
+
+ public String getKey2() {
+ return key2;
+ }
+
+ public void setKey2(String key2) {
+ this.key2 = key2;
+ }
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneKeyEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneKeyEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/KeyManyToOneKeyEntity.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,24 @@
+// $Id: KeyManyToOneKeyEntity.java 7091 2005-06-08 19:31:26Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of KeyManyToOneKeyEntity.
+ *
+ * @author Steve Ebersole
+ */
+public class KeyManyToOneKeyEntity {
+ private Long id;
+ private String name;
+
+ public KeyManyToOneKeyEntity(String name) {
+ this.name = name;
+ }
+
+ 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/hql/Lizard.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Lizard.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Lizard.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,9 @@
+//$Id: Lizard.java 3890 2004-06-03 16:31:32Z steveebersole $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class Lizard extends Reptile {
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Mammal.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Mammal.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Mammal.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,30 @@
+//$Id: Mammal.java 6005 2005-03-04 11:41:11Z oneovthafew $
+package mapping.hql;
+
+import java.util.Date;
+
+/**
+ * @author Gavin King
+ */
+public class Mammal extends Animal {
+ private boolean pregnant;
+ private Date birthdate;
+
+ public boolean isPregnant() {
+ return pregnant;
+ }
+
+ public void setPregnant(boolean pregnant) {
+ this.pregnant = pregnant;
+ }
+
+ public Date getBirthdate() {
+ return birthdate;
+ }
+
+
+ public void setBirthdate(Date birthdate) {
+ this.birthdate = birthdate;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/MoreCrazyIdFieldNameStuffEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/MoreCrazyIdFieldNameStuffEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/MoreCrazyIdFieldNameStuffEntity.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,44 @@
+// $Id: MoreCrazyIdFieldNameStuffEntity.java 7471 2005-07-14 14:58:28Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of MoreCrazyIdFieldNameStuffEntity.
+ *
+ * @author Steve Ebersole
+ */
+public class MoreCrazyIdFieldNameStuffEntity {
+ private Long moreCrazyIdFieldNameStuffEntity;
+ private HeresAnotherCrazyIdFieldName heresAnotherCrazyIdFieldName; // silly ain't it
;)
+ private String name;
+
+ public MoreCrazyIdFieldNameStuffEntity() {
+ }
+
+ public MoreCrazyIdFieldNameStuffEntity(String name) {
+ this.name = name;
+ }
+
+ public Long getMoreCrazyIdFieldNameStuffEntity() {
+ return moreCrazyIdFieldNameStuffEntity;
+ }
+
+ public void setMoreCrazyIdFieldNameStuffEntity(Long moreCrazyIdFieldNameStuffEntity) {
+ this.moreCrazyIdFieldNameStuffEntity = moreCrazyIdFieldNameStuffEntity;
+ }
+
+ public HeresAnotherCrazyIdFieldName getHeresAnotherCrazyIdFieldName() {
+ return heresAnotherCrazyIdFieldName;
+ }
+
+ public void setHeresAnotherCrazyIdFieldName(HeresAnotherCrazyIdFieldName
heresAnotherCrazyIdFieldName) {
+ this.heresAnotherCrazyIdFieldName = heresAnotherCrazyIdFieldName;
+ }
+
+ 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/hql/Name.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Name.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Name.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,43 @@
+//$Id: Name.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class Name {
+ private String first;
+ private char initial;
+ private String last;
+
+ protected Name() {}
+
+ public Name(String first, char initial, String last) {
+ this.first = first;
+ this.initial = initial;
+ this.last = last;
+ }
+
+ public String getFirst() {
+ return first;
+ }
+
+ public void setFirst(String first) {
+ this.first = first;
+ }
+
+ public char getInitial() {
+ return initial;
+ }
+
+ public void setInitial(char initial) {
+ this.initial = initial;
+ }
+
+ public String getLast() {
+ return last;
+ }
+
+ public void setLast(String last) {
+ this.last = last;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/PettingZoo.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/PettingZoo.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/PettingZoo.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,9 @@
+//$Id: PettingZoo.java 4857 2004-12-02 16:28:57Z oneovthafew $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class PettingZoo extends Zoo {
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Pickup.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Pickup.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Pickup.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,10 @@
+// $Id: Pickup.java 7087 2005-06-08 18:23:44Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Pickup.
+ *
+ * @author Steve Ebersole
+ */
+public class Pickup extends Truck {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Reptile.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Reptile.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Reptile.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,15 @@
+//$Id: Reptile.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.hql;
+
+/**
+ * @author Gavin King
+ */
+public class Reptile extends Animal {
+ private float bodyTemperature;
+ public float getBodyTemperature() {
+ return bodyTemperature;
+ }
+ public void setBodyTemperature(float bodyTemperature) {
+ this.bodyTemperature = bodyTemperature;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SUV.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SUV.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SUV.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,10 @@
+// $Id: SUV.java 7087 2005-06-08 18:23:44Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of SUV.
+ *
+ * @author Steve Ebersole
+ */
+public class SUV extends Truck {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleAssociatedEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleAssociatedEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleAssociatedEntity.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,63 @@
+package mapping.hql;
+
+/**
+ * @author Steve Ebersole
+ */
+public class SimpleAssociatedEntity {
+ private Long id;
+ private String name;
+ private SimpleEntityWithAssociation owner;
+
+ public SimpleAssociatedEntity() {
+ }
+
+ public SimpleAssociatedEntity(String name) {
+ this.name = name;
+ }
+
+ public SimpleAssociatedEntity(String name, SimpleEntityWithAssociation owner) {
+ this( name );
+ bindToOwner( owner );
+ }
+
+ 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 SimpleEntityWithAssociation getOwner() {
+ return owner;
+ }
+
+ public void setOwner(SimpleEntityWithAssociation owner) {
+ this.owner = owner;
+ }
+
+ public void bindToOwner(SimpleEntityWithAssociation owner) {
+ if ( owner != this.owner ) {
+ unbindFromCurrentOwner();
+ if ( owner != null ) {
+ owner.getAssociatedEntities().add( this );
+ }
+ }
+ this.owner = owner;
+ }
+
+ public void unbindFromCurrentOwner() {
+ if ( this.owner != null ) {
+ this.owner.getAssociatedEntities().remove( this );
+ this.owner = null;
+ }
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql">
+
+ <!-- *Very* important for the test cases that these entities have identically
named columns! -->
+
+ <class name="SimpleEntityWithAssociation"
table="SIMPLE_1">
+ <id name="id" column="ID" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="name" column="NAME"
type="string"/>
+ <set name="associatedEntities" cascade="all"
inverse="true" lazy="true">
+ <key column="SIMPLE_1_ID"/>
+ <one-to-many class="SimpleAssociatedEntity"/>
+ </set>
+ <set name="manyToManyAssociatedEntities"
cascade="save-update" inverse="false" lazy="true"
table="MANY_TO_MANY">
+ <key column="IN_ID"/>
+ <many-to-many class="SimpleEntityWithAssociation"
column="OUT_ID"/>
+ </set>
+ </class>
+
+ <class name="SimpleAssociatedEntity" table="SIMPLE_2">
+ <id name="id" column="ID" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="name" column="NAME"
type="string" />
+ <many-to-one name="owner"
class="SimpleEntityWithAssociation" column="SIMPLE_1_ID"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/SimpleEntityWithAssociation.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,70 @@
+package mapping.hql;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Steve Ebersole
+ */
+public class SimpleEntityWithAssociation {
+ private Long id;
+ private String name;
+ private Set associatedEntities = new HashSet();
+ private Set manyToManyAssociatedEntities = new HashSet();
+
+ public SimpleEntityWithAssociation() {
+ }
+
+ public SimpleEntityWithAssociation(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 Set getAssociatedEntities() {
+ return associatedEntities;
+ }
+
+ public void setAssociatedEntities(Set associatedEntities) {
+ this.associatedEntities = associatedEntities;
+ }
+
+ public SimpleAssociatedEntity addAssociation(String name) {
+ return new SimpleAssociatedEntity( name, this );
+ }
+
+ public void addAssociation(SimpleAssociatedEntity association) {
+ association.bindToOwner( this );
+ }
+
+ public void removeAssociation(SimpleAssociatedEntity association) {
+ if ( getAssociatedEntities().contains( association ) ) {
+ association.unbindFromCurrentOwner();
+ }
+ else {
+ throw new IllegalArgumentException( "SimpleAssociatedEntity [" + association
+ "] not currently bound to this [" + this + "]" );
+ }
+ }
+
+ public Set getManyToManyAssociatedEntities() {
+ return manyToManyAssociatedEntities;
+ }
+
+ public void setManyToManyAssociatedEntities(Set manyToManyAssociatedEntities) {
+ this.manyToManyAssociatedEntities = manyToManyAssociatedEntities;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/StateProvince.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/StateProvince.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/StateProvince.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,37 @@
+// $Id: StateProvince.java 7996 2005-08-22 14:49:57Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of StateProvince.
+ *
+ * @author Steve Ebersole
+ */
+public class StateProvince {
+ private Long id;
+ private String name;
+ private String isoCode;
+
+ 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 getIsoCode() {
+ return isoCode;
+ }
+
+ public void setIsoCode(String isoCode) {
+ this.isoCode = isoCode;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/TimestampVersioned.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/TimestampVersioned.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/TimestampVersioned.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,38 @@
+// $Id: TimestampVersioned.java 7384 2005-07-06 17:04:45Z steveebersole $
+package mapping.hql;
+
+import java.util.Date;
+
+/**
+ * Implementation of TimestampVersioned.
+ *
+ * @author Steve Ebersole
+ */
+public class TimestampVersioned {
+ private Long id;
+ private Date version;
+ private String name;
+
+ public TimestampVersioned() {
+ }
+
+ public TimestampVersioned(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getVersion() {
+ return version;
+ }
+
+ 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/hql/Truck.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Truck.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Truck.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,10 @@
+// $Id: Truck.java 7087 2005-06-08 18:23:44Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Truck.
+ *
+ * @author Steve Ebersole
+ */
+public class Truck extends Vehicle {
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/User.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/User.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/User.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,48 @@
+//$Id: User.java 5891 2005-02-24 01:18:15Z oneovthafew $
+package mapping.hql;
+
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private Long id;
+ private String userName;
+ private Human human;
+ private List permissions;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public Human getHuman() {
+ return human;
+ }
+
+ public void setHuman(Human human) {
+ this.human = human;
+ }
+
+ public List getPermissions() {
+ return permissions;
+ }
+
+
+ public void setPermissions(List permissions) {
+ this.permissions = permissions;
+ }
+
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -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.hql">
+
+ <!-- Vehicle represents an abstract root of a union-subclass hierarchy -->
+ <class name="Vehicle" abstract="true">
+ <id name="id" access="field" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="vin" type="string"/>
+ <property name="owner" type="string"/>
+
+ <!-- Car represents a concrete leaf of a union-subclass hierarchy with no concrete
super -->
+ <union-subclass name="Car"/>
+
+ <!-- Truck represents a concrete subclass in a union-subclass hierarchy with
concrete subclasses and no concrete super -->
+ <union-subclass name="Truck">
+ <!-- Both SUV and Pickup represent concrete leaf of a union-subclass hierarchy
(like Car), but with a concrete super -->
+ <union-subclass name="SUV"/>
+ <union-subclass name="Pickup"/>
+ </union-subclass>
+ </class>
+
+ <sql-query name="native-delete-car">
+ <synchronize table="Car"/>
+ delete from CAR where owner = ?
+ </sql-query>
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Vehicle.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,29 @@
+// $Id: Vehicle.java 7087 2005-06-08 18:23:44Z steveebersole $
+package mapping.hql;
+
+/**
+ * Implementation of Vehicle.
+ *
+ * @author Steve Ebersole
+ */
+public abstract class Vehicle {
+ private Long id;
+ private String vin;
+ private String owner;
+
+ public String getVin() {
+ return vin;
+ }
+
+ public void setVin(String vin) {
+ this.vin = vin;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Versions.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Versions.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Versions.hbm.xml 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.hql"
default-access="field">
+
+ <class name="IntegerVersioned">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <version name="version" column="vers"/>
+ <property name="name"/>
+ </class>
+
+ <class name="TimestampVersioned">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <timestamp name="version" column="vers"/>
+ <property name="name"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Zoo.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Zoo.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/Zoo.java 2007-07-17
16:34:59 UTC (rev 2481)
@@ -0,0 +1,64 @@
+//$Id: Zoo.java 10976 2006-12-12 23:22:26Z steve.ebersole(a)jboss.com $
+package mapping.hql;
+
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class Zoo {
+ private Long id;
+ private String name;
+ private Classification classification;
+ private Map animals;
+ private Map mammals;
+ private Address address;
+
+ 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 Map getMammals() {
+ return mammals;
+ }
+
+ public void setMammals(Map mammals) {
+ this.mammals = mammals;
+ }
+
+ public Map getAnimals() {
+ return animals;
+ }
+
+ public void setAnimals(Map animals) {
+ this.animals = animals;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ public Classification getClassification() {
+ return classification;
+ }
+
+ public void setClassification(Classification classification) {
+ this.classification = classification;
+ }
+}