mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-20 01:55:02 +00:00
HHH-7439: Added tests to support unidirectional one-to-many lists, but not for maps since current test infrastructure doesn't support anything but Java collections. Tests failed to illuminate any additional problems, contrary to what we were expecting, so skipping map support for now.
This commit is contained in:
parent
288155bcb2
commit
5932915b68
@ -60,6 +60,7 @@
|
||||
not-null="true"
|
||||
cascade="none"
|
||||
lazy="false"/>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="Vehicle" table="HB_Vehicle">
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
public class Transport {
|
||||
|
||||
|
||||
// @Id
|
||||
// @SequenceGenerator(name="TRANSPORT_SEQ", sequenceName="TRANSPORT_SEQ", initialValue=1, allocationSize=1)
|
||||
// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TRANSPORT_SEQ")
|
||||
@ -38,7 +38,7 @@ public class Transport {
|
||||
private long version;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
/** node value object at which the order is picked up */
|
||||
// @ManyToOne(optional=false, cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch=FetchType.EAGER)
|
||||
// @JoinColumn(name="PICKUPNODEID", /*nullable=false,*/insertable=true, updatable=true)
|
||||
@ -50,7 +50,7 @@ public class Transport {
|
||||
private Node deliveryNode = null;
|
||||
|
||||
private Vehicle vehicle;
|
||||
|
||||
|
||||
// @Transient
|
||||
private String transientField = "transport original value";
|
||||
|
||||
@ -93,7 +93,7 @@ public long getVersion() {
|
||||
protected void setVersion(long version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@ -101,13 +101,14 @@ public String getName() {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
|
||||
buffer.append(name + " id: " + transportID + "\n");
|
||||
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2007-2011, Red Hat Inc. 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 Inc.
|
||||
*
|
||||
* 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.event.collection.association.unidirectional.onetomany;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class UnidirectionalOneToManyListCollectionEventTest extends AbstractAssociationCollectionEventTest {
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "event/collection/association/unidirectional/onetomany/UnidirectionalOneToManyListMapping.hbm.xml" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParentWithCollection createParent(String name) {
|
||||
return new ParentWithCollectionOfEntities( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection createCollection() {
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC
|
||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.unidirectional">
|
||||
|
||||
<class name="ParentWithCollectionOfEntities" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<list name="children"
|
||||
cascade="all">
|
||||
<key column="parent_id"/>
|
||||
<list-index column="list_index"/>
|
||||
<one-to-many class="org.hibernate.test.event.collection.ChildEntity"/>
|
||||
</list>
|
||||
</class>
|
||||
|
||||
<class name="org.hibernate.test.event.collection.ChildEntity" table="CHILD">
|
||||
<id name="id" column="ID" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<property name="name" column="NAME" type="string"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
Loading…
x
Reference in New Issue
Block a user