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

Emmanuel Bernard (JIRA) noreply at atlassian.com
Fri Aug 25 19:31:25 EDT 2006


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

Emmanuel Bernard reassigned ANN-252:
------------------------------------

    Assign To: Max Rydahl Andersen

Max, you're working on user errors, here is one

> 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: Max Rydahl Andersen

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