Skip to content

Scan classpath for persistence annotations when creating session factory for hibernate [SPR-4738] #9415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Apr 21, 2008 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 21, 2008

Dave Syer opened SPR-4738 and commented

Scan classpath for persistence annotations when creating session factory for hibernate. The AnnotationSessionFactoryBean requires me to explictly enumerate all classes that are annotated, whereas I know Spring could discover that for me, e.g.:

<bean id="sessionFactory"
	class="org...AutoDiscoverAnnotationSessionFactoryBean">
	<property name="basePackage"
		value="com.springsource.consulting.integration" />
	<property name="dataSource" ref="dataSource" />
            ...
</bean>

Affects: 2.5.3

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 13, 2008

Juergen Hoeller commented

I've added a "packagesToScan" property to Spring's AnnotationSessionFactoryBean, searching the specified packages for @Entity classes and automatically registering them. This is reusing the same core facility that Spring 2.5's component-scan feature uses.

Reopened and resolved #6038, which suggested more or less the same feature.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Paul Benedict commented

Would it be too much to also add a classesToExcludeFromScan property? It would accept a collection of FQN classes (<list>). Sometimes there are particular classes out of a large breath of packages I'd want to exclude temporarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants