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

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Aug 6 20:50:11 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27755 ] 

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