Author: schorlet Date: 2008-11-13 16:48:45 +0000 (Thu, 13 Nov 2008) New Revision: 1213 Modified: topia/trunk/changelog topia/trunk/src/main/java/org/codelutin/topia/generator/EntityAbstractGenerator.java topia/trunk/src/main/java/org/codelutin/topia/generator/EntityHibernateMappingGenerator.java Log: - correction du bug sur la navigation bidirectionnelle entre deux entit?\195?\169s - ajout du support du lazy loading sur un attribut ?\195?\160 multiplicit?\195?\169 0..* d'une entit?\195?\169 Modified: topia/trunk/changelog =================================================================== --- topia/trunk/changelog 2008-11-07 17:03:09 UTC (rev 1212) +++ topia/trunk/changelog 2008-11-13 16:48:45 UTC (rev 1213) @@ -1,4 +1,6 @@ ver-2-0-28 ?? 2008?? + * 20081113 [chorlet] add support for lazy loading on attribute with 0..* multiplicity + * 20081113 [chorlet] fix bug on bidirectional association by adding inverse attribute in the one side of two hibernate mapping files * 20081107 [chatellier] fix "result" named attribute generation in model * 20081107 [chatellier] fix ant:ant, org.apache.ant:ant conflict * 20081107 [chatellier] set lutingenerator provided scope @@ -141,4 +143,4 @@ * Correction du support des classes d'associations (mauvais mapping Hibernate) * Support de super classes pour les classes d'association (LutinGenerator 0.29) - \ No newline at end of file + Modified: topia/trunk/src/main/java/org/codelutin/topia/generator/EntityAbstractGenerator.java =================================================================== --- topia/trunk/src/main/java/org/codelutin/topia/generator/EntityAbstractGenerator.java 2008-11-07 17:03:09 UTC (rev 1212) +++ topia/trunk/src/main/java/org/codelutin/topia/generator/EntityAbstractGenerator.java 2008-11-13 16:48:45 UTC (rev 1213) @@ -404,7 +404,10 @@ /*{ <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(this); }*/ } else { -/*{ <%=attr.getName()%>.get<%=Util.capitalize(reverse.getName())%>().add(this); +/*{ if (<%=attr.getName()%>.get<%=Util.capitalize(reverse.getName())%>() == null) { + <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(new <%=collectionObject%><<%=reverse.getType()%>>()); + } + <%=attr.getName()%>.get<%=Util.capitalize(reverse.getName())%>().add(this); }*/ } } Modified: topia/trunk/src/main/java/org/codelutin/topia/generator/EntityHibernateMappingGenerator.java =================================================================== --- topia/trunk/src/main/java/org/codelutin/topia/generator/EntityHibernateMappingGenerator.java 2008-11-07 17:03:09 UTC (rev 1212) +++ topia/trunk/src/main/java/org/codelutin/topia/generator/EntityHibernateMappingGenerator.java 2008-11-13 16:48:45 UTC (rev 1213) @@ -361,7 +361,12 @@ protected void generateHibernateMany(Writer output, ObjectModelAttribute attr) throws IOException { boolean needsIndex = attr.isIndexed(); String collType = GeneratorUtil.getNMultiplicityHibernateType(attr); -/*{ <<%=collType%> name="<%=getName(attr)%>" node="<%=getName(attr)%>" embed-xml="true"> + String lazy = ""; + if (attr.getTagValue("lazy") != null) { + lazy = "lazy=\"" + attr.getTagValue("lazy") + "\""; + } + +/*{ <<%=collType%> name="<%=getName(attr)%>" node="<%=getName(attr)%>" embed-xml="true" <%=lazy%>> <key column="OWNER"/> }*/ if (needsIndex) { @@ -406,8 +411,10 @@ // Dans le cas contraire, les modifications dans la relation ne seront // pas sauvegardées. Ceci n'est vrai que si les deux coté sont navigable boolean isInverse = attr.isNavigable() && attr.getReverseAttribute().isNavigable(); - isInverse |= !Util.isFirstAttribute(attr); - isInverse = false; // 20070117 poussin: pour du many, jamais de inverse + //isInverse |= !Util.isFirstAttribute(attr); + //isInverse = false; // 20070117 poussin: pour du many, jamais de inverse + isInverse &= Util.isFirstAttribute(attr); + boolean needsIndex = attr.isIndexed(); String cascade = ""; if (attr.isComposite() || attr.hasAssociationClass()) {