From: Emmanuel B. (JIRA) <no...@at...> - 2006-05-11 03:58:11
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-341?page=all ] Emmanuel Bernard resolved ANN-341: ---------------------------------- Resolution: Rejected as per the spec use @entity(name="myuniquename") > EntityBinder is always auto-import > ---------------------------------- > > Key: ANN-341 > URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-341 > Project: Hibernate Annotations > Type: Bug > Components: binder > Versions: 3.1.0.Beta10 > Reporter: Barry Kaplan > > > I have two classes with the same unqualified name but in different packages: > package org.opentrader.foo; > @Entity > class Order { ... } > package org.opentrader.bar; > @Entity > class Order { ... } > These classes are added using AnnotationConfiguration.addAnnotatedClass(). > But when these classes are added, EntityBinder.bindEjb3Annotation will use the unqualified name as the key for storing the entity: > class EntityBinder { > ... > if ( AnnotationBinder.isDefault( ejb3Ann.name() ) ) { > name = StringHelper.unqualify( annotatedClass.getName() ); > } > else { > name = ejb3Ann.name(); > } > ... > try { > mappings.addImport( persistentClass.getEntityName(), name ); > } > catch (MappingException me) { > throw new AnnotationException( "Use of the same entity name twice: " + name ); > } > } > class Mappings { > public void addImport(...) { > String existing = (String) imports.put(rename, className); > } > } > When HbmBinder adds imports, it has logic to /not/ add the class using its unqualified name: > class HbmBinder.addImport() { > mappings.addImport( entity.getEntityName(), entity.getEntityName() ); > if ( mappings.isAutoImport() && entity.getEntityName().indexOf( '.' ) > 0 ) { > mappings.addImport( > entity.getEntityName(), > StringHelper.unqualify( entity.getEntityName() ) > ); > } > } > Should not EntityBinder also explicitly support auto-import? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |