[hibernate-issues] [Hibernate-JIRA] Resolved: (ANN-252) AnnotationConfiguration silently ignores classes that are annotated with wrong Entity, or not annotated.

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Feb 13 17:51:42 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-252?page=all ]
     
Emmanuel Bernard resolved ANN-252:
----------------------------------

    Fix Version: 3.2.2
     Resolution: Fixed
      Assign To: Emmanuel Bernard  (was: Max Rydahl Andersen)

Partial safety net, will not work when used as a JPA provider (see explainations above)

> 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
>         Type: Improvement

>   Components: binder
>     Versions: 3.1beta8
>     Reporter: Damon Feldman
>     Assignee: Emmanuel Bernard
>      Fix For: 3.2.2

>
> Original Estimate: 1 hour
>         Remaining: 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:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list