Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.2 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.3 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.2 Thu Sep 2 15:45:37 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java Wed Sep 15 14:36:04 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/09/02 15:45:37 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2004/09/15 14:36:04 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -133,15 +133,32 @@ * Return new entity *) public <%=clazz.getName()%> create<%=clazz.getName()%>() throws TopiaException { - <% if(clazz.isAbstract()){ %> + <% if(((ObjectModelClass)clazz).isAbstract()){ %> throw new TopiaException("Abstract entity can't be instanciate"); <% } else { %> return (<%=clazz.getName()%>)super.create(); <% } %> } - public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> entity) throws TopiaException{ + public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=clazz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } return (<%=clazz.getName()%>)super.makePersistent(entity); + } + + public <%=clazz.getName()%> update(<%=clazz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=clazz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + return (<%=clazz.getName()%>)super.update(entity); + } + + public void delete(<%=clazz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=clazz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + super.delete(entity); } /**