Author: mdryakhlenkov
Date: 2007-07-17 12:31:04 -0400 (Tue, 17 Jul 2007)
New Revision: 2477
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyChild.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MySibling.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/hql/
Log:
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyChild.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyChild.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyChild.java 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,41 @@
+package mapping.generatedkeys.identity;
+
+/**
+ * @author Steve Ebersole
+ */
+public class MyChild {
+ private Long id;
+ private String name;
+ private MyEntity inverseParent;
+
+ public MyChild() {
+ }
+
+ public MyChild(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 MyEntity getInverseParent() {
+ return inverseParent;
+ }
+
+ public void setInverseParent(MyEntity inverseParent) {
+ this.inverseParent = inverseParent;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.hbm.xml 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,48 @@
+<?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.generatedkeys.identity"
default-access="field">
+
+ <class name="MyEntity" table="my_entity">
+ <id name="id">
+ <generator class="identity"/>
+ </id>
+ <property name="name"/>
+
+ <!-- used to test cascades "out" to a many-to-one association
-->
+ <many-to-one name="sibling" class="MySibling"
cascade="persist, merge"/>
+
+ <!-- used to test cascades "out" to non-inverse collections -->
+ <set name="nonInverseChildren" inverse="false"
cascade="persist, merge">
+ <key column="non_inv_parent_id"/>
+ <one-to-many class="MyChild"/>
+ </set>
+
+ <!-- used to test cascades "out" to inverse collections -->
+ <set name="inverseChildren" inverse="true"
cascade="persist, merge">
+ <key column="inv_parent_id"/>
+ <one-to-many class="MyChild"/>
+ </set>
+ </class>
+
+
+ <class name="MySibling" table="my_sibling">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <many-to-one name="entity" class="MyEntity"
cascade="persist, merge"/>
+ </class>
+
+
+ <class name="MyChild" table="my_child">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <many-to-one name="inverseParent" column="inv_parent_id"
class="MyEntity"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MyEntity.java 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,62 @@
+package mapping.generatedkeys.identity;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author Steve Ebersole
+ */
+public class MyEntity {
+ private Long id;
+ private String name;
+ private MySibling sibling;
+ private Set nonInverseChildren = new HashSet();
+ private Set inverseChildren = new HashSet();
+
+ public MyEntity() {
+ }
+
+ public MyEntity(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 MySibling getSibling() {
+ return sibling;
+ }
+
+ public void setSibling(MySibling sibling) {
+ this.sibling = sibling;
+ }
+
+ public Set getNonInverseChildren() {
+ return nonInverseChildren;
+ }
+
+ public void setNonInverseChildren(Set nonInverseChildren) {
+ this.nonInverseChildren = nonInverseChildren;
+ }
+
+ public Set getInverseChildren() {
+ return inverseChildren;
+ }
+
+ public void setInverseChildren(Set inverseChildren) {
+ this.inverseChildren = inverseChildren;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MySibling.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MySibling.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/identity/MySibling.java 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,41 @@
+package mapping.generatedkeys.identity;
+
+/**
+ * @author Steve Ebersole
+ */
+public class MySibling {
+ private Long id;
+ private String name;
+ private MyEntity entity;
+
+ public MySibling() {
+ }
+
+ public MySibling(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 MyEntity getEntity() {
+ return entity;
+ }
+
+ public void setEntity(MyEntity entity) {
+ this.entity = entity;
+ }
+}
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.hbm.xml 2007-07-17
16:31:04 UTC (rev 2477)
@@ -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.generatedkeys.select"
default-access="field">
+
+ <class name="MyEntity" table="my_entity">
+
+ <id name="id">
+ <generator class="select"/>
+ </id>
+ <natural-id>
+ <property name="name"/>
+ </natural-id>
+ </class>
+
+ <database-object>
+ <create>
+ <![CDATA[CREATE OR REPLACE TRIGGER t_i_my_entity
+ BEFORE INSERT ON my_entity
+ FOR EACH ROW
+ BEGIN
+ select nvl( max(id), 0 ) + 1
+ into :new.id
+ from my_entity;
+ END;]]>
+ </create>
+ <drop>
+ <![CDATA[DROP TRIGGER t_i_my_entity]]>
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.Oracle9Dialect"/>
+ <dialect-scope name="org.hibernate.dialect.OracleDialect"/>
+ </database-object>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/select/MyEntity.java 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,28 @@
+package mapping.generatedkeys.select;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole
</a>
+ */
+public class MyEntity {
+ private Long id;
+ private String name;
+
+ public MyEntity() {
+ }
+
+ public MyEntity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return 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/generatedkeys/seqidentity/MyEntity.hbm.xml
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.hbm.xml
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.hbm.xml 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,18 @@
+<?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.generatedkeys.seqidentity"
default-access="field">
+
+ <class name="MyEntity" table="my_entity">
+
+ <id name="id">
+ <generator class="sequence-identity"/>
+ </id>
+ <natural-id>
+ <property name="name"/>
+ </natural-id>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.java
===================================================================
---
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.java
(rev 0)
+++
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/generatedkeys/seqidentity/MyEntity.java 2007-07-17
16:31:04 UTC (rev 2477)
@@ -0,0 +1,28 @@
+package mapping.generatedkeys.seqidentity;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole
</a>
+ */
+public class MyEntity {
+ private Long id;
+ private String name;
+
+ public MyEntity() {
+ }
+
+ public MyEntity(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}