I came across a problem with idbag when using CodeGenerator to generate Java sources from Map file.
Two persistent classes: Template and Definition
Relationship: many-to-many
This is the Template mapping:
Code:
<class name="persistent.model.Template" table="Template">
...........
...........
<idbag name="definitions" table="TemplateRange" lazy="true">
<collection-id column="id" type="long">
<generator class="native"/>
</collection-id>
<key column="template_id"/>
<many-to-many column="definition_id" class="persistent.model.Definition" outer-join="true"/>
</idbag>
</class>
CodeGenerator generated Template.java without error. Then I checked Template class,
Code:
public class Template implements Serializable {
/** identifier field */
private Long id;
/** persistent field */
private String name;
/** nullable persistent field */
private String description;
.....
}
Where is Definition? Suppose Template has a List of Definition.... If I changed idbag to Set, no problem.
Does CodeGenerator support idbag?
Thanks,