This topic applies to Java version only
This section covers examples on Collection, including array, Set, List and Map.
As an experienced db4o user, you may know that db4o treats Collection as first class object, which means it assigns unique UUID to each Collection. Hence a Collection can be shared among many owners. This is different to Hibernate's approach, where Collection does not have a unique ID and they cannot be shared among objects.
To bridge this gap, dRS treats Collections as second class objects and does not assign UUIDs to them. When a shared Collection is replicated from db4o to Hibernate using dRS, it is automatically cloned. Each owner of the Collection receives a copy of the Collection. Further modifications to the db4o copy will not be replicated to cloned copies. Therefore, you cannot share Collections if you want to perform RDBMS replications with dRS.
In the following examples, we will use Car as the element in the following examples.
1package f1.collection; 2
3
public class Car { 4
public String brand; 5
public String model; 6
}
01<?xml version="1.0"?> 02
03
<!DOCTYPE hibernate-mapping PUBLIC 04
"-//Hibernate/Hibernate Mapping DTD 3.0//EN" 05
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 06
07
<hibernate-mapping default-access="field" default-lazy="false" 08
default-cascade="save-update"> 09
<class name="f1.collection.Car"> 10
<id column="typed_id" type="long"> 11
<generator class="native"/> 12
</id> 13
<property name="brand"/> 14
<property name="model"/> 15
</class> 16
</hibernate-mapping>