Index: topia/src/java/org/codelutin/topia/persistence/TopiaPersistenceProxy.java diff -u topia/src/java/org/codelutin/topia/persistence/TopiaPersistenceProxy.java:1.13 topia/src/java/org/codelutin/topia/persistence/TopiaPersistenceProxy.java:1.14 --- topia/src/java/org/codelutin/topia/persistence/TopiaPersistenceProxy.java:1.13 Thu Sep 15 13:01:53 2005 +++ topia/src/java/org/codelutin/topia/persistence/TopiaPersistenceProxy.java Fri Sep 16 14:12:07 2005 @@ -23,9 +23,9 @@ * Created: 16 juillet 2005 23:52:35 CEST * * @author Benjamin POUSSIN -* @version $Revision: 1.13 $ +* @version $Revision: 1.14 $ * -* Last update: $Date: 2005/09/15 13:01:53 $ +* Last update: $Date: 2005/09/16 14:12:07 $ * by : $Author: thimel $ */ @@ -164,6 +164,7 @@ protected TopiaEntity getFieldAssociationCardinality1( TopiaPersistenceService assoPS, + boolean thisIsA, String thisField, String otherField, TopiaEntity entity) throws Exception { @@ -223,6 +224,11 @@ //On veut faire un entity.setXXX(value) // if(assoPS.getEntityClass() != entity.getEntityClass()){ // recuperation de l'objet a modifier s'il existe + if (thisIsA) { + otherField = "_attribute_A_"; + } else { + otherField = "_attribute_B_"; + } TopiaQuery query = assoPS.newQuery() .where(otherField+"=?") .addArg(entity); @@ -518,9 +524,11 @@ TopiaPersistenceService assoPS = ph.getContext().getPersistenceService(assoClass); boolean partyA = 'A' == MethodInfoHelper.associationParty(method); int[] thisCardinality = ClassInfoHelper.associationCardinality(partyA, assoClass); - String thisField = ClassInfoHelper.associationField(partyA, assoClass); +// String thisField = ClassInfoHelper.associationField(partyA, assoClass); + String thisField = "_attribute_" + ((partyA) ? 'A' : 'B') + "_"; int[] otherCardinality = ClassInfoHelper.associationCardinality(!partyA, assoClass); - String otherField = ClassInfoHelper.associationField(!partyA, assoClass); +// String otherField = ClassInfoHelper.associationField(!partyA, assoClass); + String otherField = "_attribute_" + ((!partyA) ? 'A' : 'B') + "_"; if(thisCardinality[1] == 1){ if(MethodInfoHelper.isFieldModifier(method)){ setFieldAssociationCardinality1( @@ -529,7 +537,7 @@ return null; } else { return getFieldAssociationCardinality1( - assoPS, thisField, otherField, entity); + assoPS, partyA, thisField, otherField, entity); } } else { if(MethodInfoHelper.isFieldModifier(method)){ @@ -571,6 +579,8 @@ return result; } } + } else { + System.err.println(MethodInfoHelper.type(method)); } } log.fatal("Can't find called method: " + method + " methodName: " + method.getName() + " methodArgType: " + Arrays.toString(method.getParameterTypes()));