]
Emmanuel Bernard commented on ANN-252:
--------------------------------------
it is highlighted in the doc
AnnotationConfiguration silently ignores classes that are annotated
with wrong Entity, or not annotated.
--------------------------------------------------------------------------------------------------------
Key: ANN-252
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-252
Project: Hibernate Annotations
Issue Type: Improvement
Components: binder
Affects Versions: 3.1beta8
Reporter: Damon Feldman
Assignee: Emmanuel Bernard
Fix For: 3.3.0.ga
Original Estimate: 1 hour
Remaining Estimate: 1 hour
If you import the wrong Entity (e.g. org.hibernate.annotation.Entity) in a persistent
class, the class is ignored, but no logging or other notification is made of the issue.
Recommend: adding a log statement:
log.warn("The class" + annotatedClass.getName() +"does not have the proper
annotation: " + Entity.class.getName());
Here is the code that seems responsible:
/**
* Read a mapping from the class annotation metadata (JSR 175).
*
* @param persistentClass the mapped class
* @return the configuration object
*/
public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws
MappingException {
try {
if ( persistentClass.isAnnotationPresent( Entity.class ) ) {
annotatedClassEntities.put( persistentClass.getName(), persistentClass );
}
annotatedClasses.add( persistentClass );
return this;
}
catch (MappingException me) {
log.error( "Could not compile the mapping annotations", me );
throw me;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: