
Chapter 9 Generating Persistent Objects for Java and JSF Pages
Mapping collections of value types
If there is a value type class on the navigable role side of an association with a multiplicity of one, PowerDesigner will embed the value type in the entity type as a composite attribute.
To map collections of value type:
- Create an entity type class.
- Create another class for value type.
- Open the property sheet of the class, click the Detail tab, and select the Value type radio button.
- Create an association between the value type class and an entity type class. On the value type side, set the multiplicity to one and the navigability to true.
- Generate the PDM with O/R mapping.
- Open the property sheet of the entity class and click the Preview tab.
- Verify the mapping file.
A composite entity class may contain components, using the <nested-composite-element> declaration.
To define association collection type for one-to-many or many-to-many associations:
- Open the association property sheet and click the Detail tab.
- Specify a Multiplicity on both sides.
- Specify either unidirectional or bi-directional navigability.
- Specify role names if necessary.
- If one role of the association is navigable and the multiplicity is many, you can set the collection container type and batch loading size.
- If you select java.util.List or <none>, it implies that you want to use an array or list-indexed collection type. Then you should define an index column to preserve the objects collection order in the database.
Note: The Java collection container type conditions the Hibernate collection type.
Collection Container Type
|
Hibernate Collection Type
|
<None>
|
array
|
java.util.Collection
|
bag or idbag (many-to-many)
|
java.util.List
|
list
|
java.util.Set
|
set
|
Copyright (C) 2007. Sybase Inc. All rights reserved.
|
|