From a5c324f93484c572ef2dd63333b8dfa48e8a977f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 28 May 2009 11:25:39 +0000 Subject: [PATCH] Hibernate AnnotationSessionFactoryBean detects Hibernate's special @Entity annotation too (SPR-5787) --- .../annotation/AnnotationSessionFactoryBean.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java index 6bbccf5e53..d9a06ccf22 100644 --- a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java +++ b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +89,8 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem private TypeFilter[] entityTypeFilters = new TypeFilter[] { new AnnotationTypeFilter(Entity.class, false), new AnnotationTypeFilter(Embeddable.class, false), - new AnnotationTypeFilter(MappedSuperclass.class, false)}; + new AnnotationTypeFilter(MappedSuperclass.class, false), + new AnnotationTypeFilter(org.hibernate.annotations.Entity.class, false)}; private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); @@ -141,7 +142,8 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem * Specify custom type filters for Spring-based scanning for entity classes. *

Default is to search all specified packages for classes annotated with * @javax.persistence.Entity, @javax.persistence.Embeddable - * or @javax.persistence.MappedSuperclass. + * or @javax.persistence.MappedSuperclass, as well as for + * Hibernate's special @org.hibernate.annotations.Entity. * @see #setPackagesToScan */ public void setEntityTypeFilters(TypeFilter[] entityTypeFilters) {