Skip to content

In AnnotationSessionFactoryBean, be able to specify annotatedPackages and packagesToScan in one property [SPR-10288] #14922

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 Feb 13, 2013 · 6 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 13, 2013

Sanjay Deshmukh opened SPR-10288 and commented

I tend to have package-level annotations on all of my packages that contain Hibernate-annotated classes. The biggest one is a @TypeDef to persist joda-time DateTimes and LocalTimes. It would be nice to have a single property through which I can set both annotatedPackages and packagesToScan, rather than passing the same list to both.


Affects: 3.2.1

Attachments:

Issue Links:

Referenced from: commits 5334ac5

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

As of 3.2.2, "packagesToScan" detects package-info classes as well and passes them to Hibernate's addPackage method. This means that specifying "packagesToScan" should be sufficient for your use case now.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Sanjay Deshmukh commented

Beautiful - thank you!

@spring-projects-issues
Copy link
Collaborator Author

Yannick Lazzari commented

Hi,

Are there any plans to bring the same functionality to the org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean class which also has the packagesToScan property but doesn't offer the same flexibility (I just looked in version 3.2.4)? Unless there's another way to achieve the same behavior that I'm not aware of.

Thanks.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 20, 2013

Peter Cooper Jr. commented

See also #13233

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 17, 2014

Juergen Hoeller commented

Yannick, related to my comment on #13233: Check out #15538 for JPA support there, scheduled for Spring Framework 4.1 at this point.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Yannick Lazzari commented

Thank you. I'll be watching that issue then. It will be very useful for testing. When you have a big system with hundreds of entities, it's nice to have a separate config to bootstrap your entity manager with only a subset of entities (using the packagesToScan property). Makes for faster startup times of test cases that only need to deal with a specific part of the system. The problem is that I have @TypeDefs and @GenericGenerator defined in a package-info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants