Skip to content

Commit a5c324f

Browse files
committed
Hibernate AnnotationSessionFactoryBean detects Hibernate's special @entity annotation too (SPR-5787)
1 parent a26a227 commit a5c324f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2009 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -89,7 +89,8 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
8989
private TypeFilter[] entityTypeFilters = new TypeFilter[] {
9090
new AnnotationTypeFilter(Entity.class, false),
9191
new AnnotationTypeFilter(Embeddable.class, false),
92-
new AnnotationTypeFilter(MappedSuperclass.class, false)};
92+
new AnnotationTypeFilter(MappedSuperclass.class, false),
93+
new AnnotationTypeFilter(org.hibernate.annotations.Entity.class, false)};
9394

9495
private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
9596

@@ -141,7 +142,8 @@ public void setPackagesToScan(String[] packagesToScan) {
141142
* Specify custom type filters for Spring-based scanning for entity classes.
142143
* <p>Default is to search all specified packages for classes annotated with
143144
* <code>@javax.persistence.Entity</code>, <code>@javax.persistence.Embeddable</code>
144-
* or <code>@javax.persistence.MappedSuperclass</code>.
145+
* or <code>@javax.persistence.MappedSuperclass</code>, as well as for
146+
* Hibernate's special <code>@org.hibernate.annotations.Entity</code>.
145147
* @see #setPackagesToScan
146148
*/
147149
public void setEntityTypeFilters(TypeFilter[] entityTypeFilters) {

0 commit comments

Comments
 (0)