Hi
I've read the documentation, I created a flattened many-to-many
relationship, but any record has been inserted inside the connection table.
I have the following tables and relationships:
<db-entity name="NE_ENTITY">
<db-attribute name="entityType" type="VARCHAR" length="255"/>
<db-attribute name="id" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
</db-entity>
<db-entity name="NE_ENTITY_NAME">
<db-attribute name="id" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="15"/>
<db-attribute name="name" type="BLOB" length="150"/>
</db-entity>
<db-entity name="NE_NAME_RELATION">
<db-attribute name="id_entity" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="id_entity_name" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="15"/>
</db-entity>
<db-relationship name="NE_ENTITY_NAME_ARRAY" source="NE_ENTITY"
target="NE_ENTITY_NAME" toMany="true">
<db-attribute-pair source="id" target="id"/>
</db-relationship>
<db-relationship name="toEntityGenericAttribute" source="NE_ENTITY"
target="NE_ENTITY_GENERIC_ATTRIBUTE" toDependentPK="true" toMany="false">
<db-attribute-pair source="id" target="id_entity"/>
</db-relationship>
<db-relationship name="toNameRelation" source="NE_ENTITY"
target="NE_NAME_RELATION" toDependentPK="true" toMany="true">
<db-attribute-pair source="id" target="id_entity"/>
</db-relationship>
<db-relationship name="toEntityArray" source="NE_ENTITY_NAME"
target="NE_ENTITY" toDependentPK="true" toMany="false">
<db-attribute-pair source="id" target="id"/>
</db-relationship>
<db-relationship name="toNameRelation" source="NE_ENTITY_NAME"
target="NE_NAME_RELATION" toDependentPK="true" toMany="true">
<db-attribute-pair source="id" target="id_entity_name"/>
</db-relationship>
<db-relationship name="toEntity" source="NE_NAME_RELATION"
target="NE_ENTITY" toMany="false">
<db-attribute-pair source="id_entity" target="id"/>
</db-relationship>
<db-relationship name="toEntityName" source="NE_NAME_RELATION"
target="NE_ENTITY_NAME" toMany="false">
<db-attribute-pair source="id_entity_name" target="id"/>
</db-relationship>
<obj-relationship name="toEntityName" source="NeEntity"
target="NeEntityName" db-relationship-path="NE_ENTITY_NAME_ARRAY"/>
<obj-relationship name="toNameRelation" source="NeEntity"
target="NeNameRelation" db-relationship-path="toNameRelation"/>
<obj-relationship name="toEntity" source="NeNameRelation" target="NeEntity"
db-relationship-path="toEntity"/>
<obj-relationship name="toEntityName" source="NeNameRelation"
target="NeEntityName" db-relationship-path="toEntityName"/>
in Java:
NeEntity entity = (NeEntity) context.newObject(NeEntity.class);
NeEntityName entityName=(NeEntityName) context.newObject(NeEntityName.class
);
entity.setEntityType(typeEntity);
entityName.setName(term);
entity.addToToEntityName(entityName);
context.commitChanges();
but it does not insert any records in the table NE_NAME_RELATION
:-((((((((((
thanks a lot
Marco
On 12/11/06, Tore Halset <halse..vv.ntnu.no> wrote:
>
> Hello.
>
> Read the documentation on flattened many-to-many relationship.
>
> http://cwiki.apache.org/CAYDOC/cayennemodeler-flattened-
> relationships.html
> http://www.google.com/search?q=cayenne+flattened+relationship+site%
> 3Acwiki.apache.org
>
> - Tore.
>
> On Dec 10, 2006, at 18:59 , marco turchi wrote:
>
> > Hi Marcin,
> >
> > I check my model, and now the xxx.map.xml is equal to your example.
> > The new problem is inside Java.
> > you wrote:
> >
> >> Entity e = getContext().newObject(Entity.class);
> >> Name n getContext().newObject(Name.class);
> >> e.addToNames(n);
> >> getContext().commitChanges();
> >
> > but the method addToName does not accept a Name object, but a
> > NameRelation
> > object.
> > Do you know where the error is?
> >
> > Thanks a lot
> > Marco
> >
> >
>
>
This archive was generated by hypermail 2.0.0 : Mon Dec 11 2006 - 07:01:52 EST