Author: steve.ebersole(a)jboss.com
Date: 2008-10-03 17:10:16 -0400 (Fri, 03 Oct 2008)
New Revision: 15255
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml
Log:
HHH-1907 : component + EntityMode.DOM4J
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java
(rev 0)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java 2008-10-03
21:10:16 UTC (rev 15255)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class Component {
+ private ComponentReference reference;
+
+ public Component() {
+ }
+
+ public Component(ComponentReference reference) {
+ this.reference = reference;
+ }
+
+ public ComponentReference getReference() {
+ return reference;
+ }
+
+ public void setReference(ComponentReference reference) {
+ this.reference = reference;
+ }
+}
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java
(rev 0)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java 2008-10-03
21:10:16 UTC (rev 15255)
@@ -0,0 +1,58 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class ComponentOwner {
+ private Long id;
+ private Component component;
+
+ public ComponentOwner() {
+ }
+
+ public ComponentOwner(Component component) {
+ this.component = component;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ }
+}
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java
(rev 0)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java 2008-10-03
21:10:16 UTC (rev 15255)
@@ -0,0 +1,45 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class ComponentReference {
+ private Long id;
+
+ public ComponentReference() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java
(rev 0)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java 2008-10-03
21:10:16 UTC (rev 15255)
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+import junit.framework.Test;
+
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.Session;
+import org.hibernate.EntityMode;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class Dom4jComponentTest extends FunctionalTestCase {
+ public Dom4jComponentTest(String string) {
+ super( string );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "entitymode/dom4j/component/Mapping.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setProperty( Environment.DEFAULT_ENTITY_MODE, EntityMode.DOM4J.toString() );
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( Dom4jComponentTest.class );
+ }
+
+ public void testSetAccessorsFailureExpected() {
+ // An example of part of the issue discussed in HHH-1907
+ Session session = openSession();
+ session.beginTransaction();
+ session.getSession( EntityMode.POJO ).save( new ComponentOwner( new Component( new
ComponentReference() ) ) );
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ session.createQuery( "from ComponentOwner" ).list();
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ session.createQuery( "delete ComponentOwner" ).executeUpdate();
+ session.createQuery( "delete ComponentReference" ).executeUpdate();
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml
(rev 0)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml 2008-10-03
21:10:16 UTC (rev 15255)
@@ -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, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ ~
+ -->
+
+<hibernate-mapping
package="org.hibernate.test.entitymode.dom4j.component">
+
+ <class name="ComponentOwner">
+ <id name="id" type="long" node="@id">
+ <generator class="increment"/>
+ </id>
+ <component name="component" class="Component">
+ <many-to-one name="reference"
class="ComponentReference" embed-xml="false"
cascade="all"/>
+ </component>
+ </class>
+
+ <class name="ComponentReference">
+ <id name="id" type="long" node="@id">
+ <generator class="increment"/>
+ </id>
+ </class>
+
+</hibernate-mapping>