Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToContextPropertiesGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToContextPropertiesGenerator.java:1.9 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToContextPropertiesGenerator.java:1.10 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToContextPropertiesGenerator.java:1.9 Wed Jun 2 09:09:52 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToContextPropertiesGenerator.java Fri Jun 4 18:43:54 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ * - * Mise a jour: $Date: 2004/06/02 09:09:52 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2004/06/04 18:43:54 $ + * par : $Author: bpoussin $ */ package org.codelutin.topia.generators.jdo; @@ -49,15 +49,19 @@ public void generateFromModel(Writer output, ObjectModel model) throws IOException { for(Iterator i=model.getClasses().iterator(); i.hasNext();){ ObjectModelClass clazz = (ObjectModelClass)i.next(); - if(! Util.isEntity(clazz)) continue; + if(! Util.isEntity(clazz)) continue; /*{ -<%=Util.getParentPackageName(clazz.getPackageName())%>.services.<%=clazz.getName()%>PersistenceService=<%=Util.getParentPackageName(clazz.getPackageName())%>.services.jdo.<%=clazz.getName()%>JDOPersistenceService -<%=clazz.getQualifiedName()%>=<%=clazz.getPackageName()%>.transfer.<%=clazz.getName()%>TO +mapping.service.persistence.class.<%=clazz.getQualifiedName()%>=<%=Util.getParentPackageName(clazz.getPackageName())%>.services.jdo.<%=clazz.getName()%>JDOPersistenceService +mapping.service.persistence.interface.<%=clazz.getQualifiedName()%>=<%=Util.getParentPackageName(clazz.getPackageName())%>.services.<%=clazz.getName()%>PersistenceService +mapping.entity.to.class.<%=clazz.getQualifiedName()%>=<%=clazz.getPackageName()%>.transfer.<%=clazz.getName()%>TO +mapping.entity.to.interface.<%=clazz.getQualifiedName()%>=<%=clazz.getPackageName()%>.transfer.<%=clazz.getName()%> +mapping.entity.do.class.<%=clazz.getQualifiedName()%>=<%=clazz.getPackageName()%>.persistence.<%=clazz.getName()%>JDODO +mapping.entity.do.interface.<%=clazz.getQualifiedName()%>=<%=clazz.getPackageName()%>.persistence.<%=clazz.getName()%> }*/ } /*{ -org.codelutin.topia.TopiaPersistenceHelper=org.codelutin.topia.jdo.TopiaJDOPersistenceHelper +persistence.helper=org.codelutin.topia.jdo.TopiaJDOPersistenceHelper javax.jdo.PersistenceManagerFactoryClass=com.triactive.jdo.PersistenceManagerFactoryImpl javax.jdo.option.ConnectionDriverName=org.postgresql.Driver javax.jdo.option.ConnectionURL=jdbc:postgresql://localhost/database Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.18 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.19 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.18 Fri May 28 15:40:16 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java Fri Jun 4 18:43:54 2004 @@ -29,14 +29,14 @@ public class ObjectModelToEntityDOClassGenerator extends ObjectModelGenerator { public String getFilenameForClass(ObjectModelClass clazz) { - return (clazz.getPackageName()+".persistence.").replace('.', File.separatorChar)+clazz.getName()+"JDODO.java"; + return (clazz.getPackageName()+".persistence.").replace('.', File.separatorChar)+clazz.getName()+"JDODO.java"; } public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { - // Consider only entities, return immediately if not an entity - if(! Util.isEntity(clazz)) return; + // Consider only entities, return immediately if not an entity + if(! Util.isEntity(clazz)) return; // ------------- File Header if (!"".equals(clazz.getPackageName())) { @@ -46,7 +46,7 @@ }*/ } - // ------------- Imports + // ------------- Imports /*{ import org.codelutin.topia.TopiaEntityDO; import org.codelutin.topia.AbstractTopiaEntity; @@ -57,87 +57,87 @@ import <%=clazz.getQualifiedName()%>; }*/ - for (Iterator i = clazz.getInterfaces().iterator(); i.hasNext();) { - ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); + for (Iterator i = clazz.getInterfaces().iterator(); i.hasNext();) { + ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); /*{ import <%=clazz.getPackageName()%>.<%=interfacezz.getName()%>; }*/ - } + } /*{ }*/ - - // ------------- Class start + + // ------------- Class start /*{ public class <%=clazz.getName()%>JDODO}*/ Iterator i = clazz.getSuperclasses().iterator(); - if (i.hasNext()) { - ObjectModelClass superclass = (ObjectModelClass) i.next(); + if (i.hasNext()) { + ObjectModelClass superclass = (ObjectModelClass) i.next(); /*{ extends <%=superclass.getName()%>JDODO}*/ - } else { + } else { /*{ extends AbstractTopiaEntity}*/ - } -/*{ implements <%=clazz.getName()%>, TopiaEntityDO}*/ - for (i = clazz.getInterfaces().iterator(); i.hasNext();) { - ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); + } +/*{ implements <%=clazz.getName()%>, TopiaEntityDO}*/ + for (i = clazz.getInterfaces().iterator(); i.hasNext();) { + ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); /*{, <%=interfacezz.getName()%>}*/ } /*{ { - + }*/ - // ------------- Attribute declaration - // Iterate on each attribute to generate declarations - for (i = clazz.getAttributes().iterator(); i.hasNext();) { - ObjectModelAttribute attribute = (ObjectModelAttribute) i.next(); - if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1) || (attribute.getClassifier() == null)) { + // ------------- Attribute declaration + // Iterate on each attribute to generate declarations + for (i = clazz.getAttributes().iterator(); i.hasNext();) { + ObjectModelAttribute attribute = (ObjectModelAttribute) i.next(); + if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1) || (attribute.getClassifier() == null)) { /*{ <%=attribute.getVisibility()%> <%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>; }*/ - } else { - ObjectModelClassifier classifier = attribute.getClassifier(); + } else { + ObjectModelClassifier classifier = attribute.getClassifier(); /*{ - <%=attribute.getVisibility()%> <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO; -}*/ - } - } + <%=attribute.getVisibility()%> <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO; +}*/ + } + } /*{ protected String _version; protected java.util.Date _creationDate; protected java.util.Date _lastUpdateDate; protected TopiaUser _lastUpdateUser; - public <%=clazz.getName()%>JDODO() { super(); - + public <%=clazz.getName()%>JDODO() { super(); + } - -}*/ + +}*/ // ------------- Accessors // Iterate on each attribute to declare accessors for (i = clazz.getAttributes().iterator(); i.hasNext();) { ObjectModelAttribute attribute = (ObjectModelAttribute) i.next(); - if (Util.isDerived(attribute)) { + if (Util.isDerived(attribute)) { /*{ public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { throw new TopiaException("get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>()%> is not implemented on data objects. You shall use transfer objets instead !"); } }*/ - if (!Util.isReadOnly(attribute)) { + if (!Util.isReadOnly(attribute)) { /*{ - public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { throw new TopiaException("set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) is not implemented on data objects. You shall use transfer objets instead !"); } - + }*/ - } - continue; - } - - // Not a derived attribute : + } + continue; + } + + // Not a derived attribute : if (!Util.isReadOnly(attribute)) { - if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1)) { + if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1)) { /*{ public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { return <%=attribute.getName()%>; @@ -145,68 +145,68 @@ public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { this.<%=attribute.getName()%> = (<%=attribute.getName()%> == null)?<%=Util.getAttributeInitValue(attribute)%>:<%=attribute.getName()%>; } - + }*/ - } else { - ObjectModelClassifier classifier = attribute.getClassifier(); - if (classifier == null) { + } else { + ObjectModelClassifier classifier = attribute.getClassifier(); + if (classifier == null) { // /*{ public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { return <%=attribute.getName()%>; - } - public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { - this.<%=attribute.getName()%> = <%=attribute.getName()%>; - } - -}*/ - } else { -/*{ - public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { - return <%=attribute.getName()%>DO; - } - public <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO() throws TopiaException { - return <%=attribute.getName()%>DO; - } - public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { - set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO((<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO) <%=attribute.getName()%>); - } - public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO(<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO) throws TopiaException { - this.<%=attribute.getName()%>DO = <%=attribute.getName()%>DO; - } - + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { + this.<%=attribute.getName()%> = <%=attribute.getName()%>; + } + +}*/ + } else { +/*{ + public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { + return <%=attribute.getName()%>DO; + } + public <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO() throws TopiaException { + return <%=attribute.getName()%>DO; + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { + set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO((<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO) <%=attribute.getName()%>); + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO(<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO) throws TopiaException { + this.<%=attribute.getName()%>DO = <%=attribute.getName()%>DO; + } + }*/ - } + } } } /*{ - + }*/ } - // ------------- Operations declarations - // Iterate on each operation to generate declarations - for (i = clazz.getOperations().iterator(); i.hasNext();) { - ObjectModelOperation operation = (ObjectModelOperation) i.next(); -/*{ - <%=operation.getVisibility()%> <%=operation.getReturnType()%> <%=operation.getName()%> (}*/ - // Iterate on each parameters to declare operation parameters - for (Iterator j = operation.getParameters().iterator(); - j.hasNext(); - ) { - ObjectModelParameter parameter = - (ObjectModelParameter) j.next(); + // ------------- Operations declarations + // Iterate on each operation to generate declarations + for (i = clazz.getOperations().iterator(); i.hasNext();) { + ObjectModelOperation operation = (ObjectModelOperation) i.next(); +/*{ + <%=operation.getVisibility()%> <%=operation.getReturnType()%> <%=operation.getName()%> (}*/ + // Iterate on each parameters to declare operation parameters + for (Iterator j = operation.getParameters().iterator(); + j.hasNext(); + ) { + ObjectModelParameter parameter = + (ObjectModelParameter) j.next(); /*{ <%=parameter.getType()+" "+parameter.getName()%>}*/ - if (j.hasNext()) { /*{, }*/ - } - } + if (j.hasNext()) { /*{, }*/ + } + } /*{ ) throws TopiaException { throw new TopiaException("<%=operation.getName()%>(...) is not implemented on data objects. You shall use transfer objets instead !"); } }*/ - } + } /*{ }*/ @@ -215,10 +215,10 @@ /*{ public Object _getTopiaId() throws TopiaException { System.out.println("Contxet : "+getContext()); - PersistenceManager persistenceManager = ((TopiaJDOPersistenceHelper) getContext().getPersistenceHelper()).getPersistenceManager(); + PersistenceManager persistenceManager = ((TopiaJDOPersistenceHelper) getContext().getPersistenceHelper()).getPersistenceManager(); return persistenceManager.getObjectId(this); } - + public String _getVersion() throws TopiaException { return _version; } @@ -226,20 +226,20 @@ this._version = version; } - public java.util.Date _getCreationDate() throws TopiaException { + public java.util.Date _getCreationDate() throws TopiaException { return _creationDate; } - public void _setCreationDate(java.util.Date creationDate) throws TopiaException { + public void _setCreationDate(java.util.Date creationDate) throws TopiaException { this._creationDate = creationDate; } - + public java.util.Date _getLastUpdateDate() throws TopiaException { return _lastUpdateDate; } public void _setLastUpdateDate(java.util.Date lastUpdateDate) throws TopiaException { this._lastUpdateDate = lastUpdateDate; } - + public TopiaUser _getLastUpdateUser() throws TopiaException { return _lastUpdateUser; } @@ -252,58 +252,58 @@ } - public String getFilenameForInterface(ObjectModelInterface interfacez) { - return (interfacez.getPackageName()+".persistence.").replace('.', File.separatorChar)+interfacez.getName()+"JDODO.java"; - } + public String getFilenameForInterface(ObjectModelInterface interfacez) { + return (interfacez.getPackageName()+".persistence.").replace('.', File.separatorChar)+interfacez.getName()+"JDODO.java"; + } - public void generateFromInterface(Writer output, ObjectModelInterface interfacez) - throws IOException { + public void generateFromInterface(Writer output, ObjectModelInterface interfacez) + throws IOException { - // Consider only entities, return immediately if not an entity - if (! Util.isEntity(interfacez)) return; + // Consider only entities, return immediately if not an entity + if (! Util.isEntity(interfacez)) return; - // ------------- File Header - if (!"".equals(interfacez.getPackageName())) { + // ------------- File Header + if (!"".equals(interfacez.getPackageName())) { /*{ package <%=interfacez.getPackageName()%>.persistence; }*/ - } + } - // ------------- Imports + // ------------- Imports /*{ import org.codelutin.topia.TopiaEntityDO; import org.codelutin.topia.TopiaException; import <%=interfacez.getQualifiedName()%>; }*/ - for (Iterator i = interfacez.getInterfaces().iterator(); i.hasNext();) { - ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); + for (Iterator i = interfacez.getInterfaces().iterator(); i.hasNext();) { + ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); /*{ import <%=interfacez.getPackageName()%>.<%=interfacezz.getName()%>; }*/ - } + } /*{ }*/ - - // ------------- Interface start + + // ------------- Interface start /*{ - public interface <%=interfacez.getName()%>JDODO}*/ -/*{ extends <%=interfacez.getName()%>, TopiaEntityDO}*/ - for (Iterator i = interfacez.getInterfaces().iterator(); i.hasNext();) { - ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); + public interface <%=interfacez.getName()%>JDODO}*/ +/*{ extends <%=interfacez.getName()%>, TopiaEntityDO}*/ + for (Iterator i = interfacez.getInterfaces().iterator(); i.hasNext();) { + ObjectModelInterface interfacezz = (ObjectModelInterface) i.next(); /*{, <%=interfacezz.getName()%>}*/ - } + } /*{ { - + }*/ - // ------------- Class end -/*{ + // ------------- Class end +/*{ } }*/ - } + } } Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.6 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.7 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.6 Wed Jun 2 17:36:46 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java Fri Jun 4 18:43:54 2004 @@ -23,9 +23,9 @@ * * @author Cédric Pineau * Copyright Code Lutin -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * -* Last update : $Date: 2004/06/02 17:36:46 $ +* Last update : $Date: 2004/06/04 18:43:54 $ * by : $Author: bpoussin $ */ package org.codelutin.topia.generators.jdo; @@ -66,6 +66,7 @@ // ------------- Imports /*{ import org.codelutin.topia.jdo.AbstractTopiaJDOPersistenceService; +import org.codelutin.topia.PrivateTopiaPersistenceService; import org.codelutin.topia.TopiaQuery; import org.codelutin.topia.TopiaEntity; import org.codelutin.topia.TopiaEntityTO; @@ -87,6 +88,8 @@ import javax.jdo.PersistenceManager; import javax.jdo.Transaction; import javax.jdo.Query; +import java.util.logging.Logger; +import java.util.logging.Level; }*/ @@ -161,7 +164,7 @@ * * @return the corresponding TopiaEntity TransferObject. *) - public TopiaEntityTO toTO(TopiaEntityDO topiaEntityDO) throws TopiaException { + public TopiaEntityTO toTO(TopiaEntity topiaEntityDO) throws TopiaException { return toTO((<%=clazz.getName()%>JDODO) topiaEntityDO); } @@ -219,10 +222,11 @@ * * @return the corresponding TopiaEntity DataObject. *) - public TopiaEntityDO toDO(TopiaEntityTO topiaEntityTO) throws TopiaException { - return this.toDO((<%=clazz.getName()%>TO) topiaEntityTO); + public TopiaEntityDO toDO(TopiaEntity topiaEntityTO, HashMap pendingDOs) throws TopiaException { + return this.toDO((<%=clazz.getName()%>TO) topiaEntityTO, pendingDOs); } + public <%=clazz.getName()%>JDODO toDO(<%=clazz.getName()%>TO _to) throws TopiaException { return toDO(_to, new HashMap()); } @@ -246,31 +250,35 @@ <%=clazz.getName()%>JDODO _do = (<%=clazz.getName()%>JDODO) pendingDOs.get(_to); if (_do == null) { // Not found in pending created DOs, go and create a new <%=clazz.getName()%>JDODO - _do = new <%=clazz.getName()%>JDODO(); - _do.setContext(getContext()); + _do = (<%=clazz.getName()%>JDODO)getContext().createEntityDO(<%=clazz.getQualifiedName()%>.class); pendingDOs.put(_to, _do); }*/ // Iterate on each attribute for (Iterator i = clazz.getAttributes().iterator(); i.hasNext();) { ObjectModelAttribute attribute = (ObjectModelAttribute) i.next(); + String attNameCap = Util.toUpperCaseFirstLetter(attribute.getName()); if (! attribute.referenceClassifier()) { /*{ - _do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(_to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>()); + _do.set<%=attNameCap%>(_to.get<%=attNameCap%>()); }*/ } else { - ObjectModelClassifier classifier = (ObjectModelClassifier) attribute.getClassifier(); + ObjectModelClassifier classifier = + (ObjectModelClassifier) attribute.getClassifier(); /*{ - { <%=Util.getParentPackageName(classifier.getPackageName())+".services.jdo."+classifier.getName()%>JDOPersistenceService <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService = (<%=Util.getParentPackageName(classifier.getPackageName())+".services.jdo."+classifier.getName()%>JDOPersistenceService) getContext().getToto(<%=Util.getParentPackageName(classifier.getPackageName())+".services."+classifier.getName()%>PersistenceService.class); + { + PrivateTopiaPersistenceService ps = (PrivateTopiaPersistenceService) + getContext().getPersistenceService(<%=classifier.getQualifiedName()%>.class); }*/ - if ((attribute.getMaxMultiplicity() > 1) || (attribute.getMaxMultiplicity( )== -1)) { + if ((attribute.getMaxMultiplicity() > 1) + || (attribute.getMaxMultiplicity( ) == -1)) { /*{ - //_do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>((<%=Util.getAttributeType(attribute)%>) <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService.toDO((<%=Util.getAttributeType(attribute)%>) _to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(), pendingDOs)); -} + //_do.set<%=attNameCap%>((<%=Util.getAttributeType(attribute)%>) ps.toDO(_to.get<%=attNameCap%>(), pendingDOs)); + } }*/ } else { /*{ - _do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>((<%=classifier.getPackageName()%>.persistence.<%=classifier.getName()%>JDODO) <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService.toDO((<%=classifier.getPackageName()%>.transfer.<%=classifier.getName()%>TO) _to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(), pendingDOs)); -} + _do.set<%=attNameCap%>((<%=classifier.getQualifiedName()%>)ps.toDO(_to.get<%=attNameCap%>(), pendingDOs)); + } }*/ } @@ -281,13 +289,14 @@ Transaction transaction = persistenceManager.currentTransaction(); transaction.begin(); try { - persistenceManager.makePersistent(_do); - } catch (Throwable t) { + persistenceManager.makePersistent(_do); + transaction.commit(); + } catch (Throwable eee) { transaction.rollback(); - throw (new TopiaException("Cannot make persistent !",t)); + throw (new TopiaException("Cannot make persistent !", eee)); } - transaction.commit(); - System.out.println("in new DO, topiaID is "+_do._getTopiaId()); + Logger.getLogger(getClass().getName() + ".newDO").log(Level.INFO, + "in new DO, topiaID is "+_do._getTopiaId()); } return _do; } @@ -301,7 +310,7 @@ * * @return the corresponding TopiaEntity DataObject. *) - public TopiaEntityDO toUpdatedDO(TopiaEntityTO topiaEntityTO) throws TopiaException { + public TopiaEntityDO toUpdatedDO(TopiaEntity topiaEntityTO) throws TopiaException { return this.toUpdatedDO((<%=clazz.getName()%>TO) topiaEntityTO); } @@ -360,6 +369,7 @@ // ------------- Imports /*{ import org.codelutin.topia.jdo.AbstractTopiaJDOPersistenceService; +import org.codelutin.topia.PrivateTopiaPersistenceService; import org.codelutin.topia.TopiaEntity; import org.codelutin.topia.TopiaEntityTO; import org.codelutin.topia.TopiaEntityDO; @@ -431,7 +441,7 @@ * * @return the corresponding TopiaEntity TransferObject. *) - public TopiaEntityTO toTO(TopiaEntityDO topiaEntityDO) throws TopiaException { + public TopiaEntityTO toTO(TopiaEntity topiaEntityDO) throws TopiaException { <%=interfacez.getName()%>TO _to = null; try{ // Warning : don't replace that for a Class.forName(...) has it does NOT behave the same way ! @@ -452,7 +462,7 @@ * * @return the corresponding TopiaEntity DataObject. *) - public TopiaEntityDO toDO(TopiaEntityTO topiaEntityTO) throws TopiaException { + public TopiaEntityDO toDO(TopiaEntity topiaEntityTO) throws TopiaException { <%=interfacez.getName()%>JDODO _do = null; try{ // Warning : don't replace that for a Class.forName(...) has it does NOT behave the same way ! @@ -474,7 +484,7 @@ * * @return the corresponding TopiaEntity DataObject. *) - public TopiaEntityDO toUpdatedDO(TopiaEntityTO topiaEntityTO) throws TopiaException { + public TopiaEntityDO toUpdatedDO(TopiaEntity topiaEntityTO) throws TopiaException { <%=interfacez.getName()%>JDODO _do = null; try{ // Warning : don't replace that for a Class.forName(...) has it does NOT behave the same way !