From: Vance K. <va...@us...> - 2006-01-26 04:35:49
|
User: vancek Date: 06/01/25 20:35:42 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fixed finder sql to use entity name rather than table name, moved Table and EntityListener annotations from embeddable superclass to inheriting entity class template, except for cases where this template generates the inheriting entity subclass Revision Changes Path 1.7 +11 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EntityEmbeddable.vsl 25 Jan 2006 02:50:46 -0000 1.6 +++ EntityEmbeddable.vsl 26 Jan 2006 04:35:41 -0000 1.7 @@ -37,14 +37,19 @@ @javax.persistence.Entity#if ($entity.accessType)(access = javax.persistence.AccessType.${entity.accessType})#end #end -...@ja...rsistence.EntityListener(${entity.fullyQualifiedEntityListenerName}.class) -## Include the Table annotation for a base class in inheritence hierarchy -## but not in the subclasses. +## +## Include the Table annotation for a base class in single table inheritence hierarchy +## but not in the subclasses. Include in all classes for joined and table per class +## inheritance hierarchies. ## If a class is manually specified as an embeddable superclass, add -## the Table annotation to the subclass. -#if (!$entity.requiresGeneralizationMapping && !$entity.embeddableSuperclass) +## the Table annotation to the subclass, not to the base superclass. +## +#if ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)) @javax.persistence.Table(name = "${entity.tableName}") #end +#if ($entity.requiresGeneralizationMapping) +...@ja...rsistence.EntityListener(${entity.fullyQualifiedEntityListenerName}.class) +#end ## Only include the inheritance related annotations for inheritance mapping ## that doesn't involve embeddable superclass hierarchy. #if ($entity.requiresSpecializationMapping && !$entity.embeddableSuperclass) @@ -468,7 +473,7 @@ ## For inheriting classes, replace findAll with findAll${entity.name}s public static java.util.Collection<${entity.name}> findAll#if ($entity.requiresGeneralizationMapping)$stringUtils.capitalize(${entity.name})s#end(javax.persistence.EntityManager em) { - return em.createQuery("FROM ${entity.tableName} AS $stringUtils.uncapitalize(${entity.name})").getResultList(); + return em.createQuery("FROM ${entity.name} AS $stringUtils.uncapitalize(${entity.name})").getResultList(); } #**##end |