You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: taskA general task
Deferring this issue indefinitely. After quite a bit of work on this front, it is simply not straightforward to map the current EntityManagerFactoryBeans onto the same kind of builder style approach that (Annotation)SessionFactoryBuilder follows in the Hibernate world.
The implementation I've worked up is fully functional, but suffers from the need to inject the bean ClassLoader, LoadTimeWeaver and ResourceLoader into the Builder before it can be properly used. There's really no way around this, and it's just not a great usage story.
Fortunately, in the JPA world, it's not common to actually directly inject the EntityManagerFactory due to the way that @PersistenceContext works.
For this reason, it's actually reasonable for users to configure and return a Local(Container)EntityManagerFactoryBean from a @Bean method - it has no real downside, because that @Bean method will probably never be referenced for injection purposes.
This is a minor concession - it would be nice to tell users that it's never necessary to return a FactoryBean from a @Bean method, but considering the alternative, this is probably an acceptable exception. As mentioned above, #12965 will round this support out with the introduction of @EnableLoadTimeWeaving, for JPA implementations (EclipseLink) that depend on it.
in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: taskA general task
Activity
spring-projects-issues commentedon Jun 1, 2011
Chris Beams commented
Deferring this issue indefinitely. After quite a bit of work on this front, it is simply not straightforward to map the current EntityManagerFactoryBeans onto the same kind of builder style approach that (Annotation)SessionFactoryBuilder follows in the Hibernate world.
The implementation I've worked up is fully functional, but suffers from the need to inject the bean ClassLoader, LoadTimeWeaver and ResourceLoader into the Builder before it can be properly used. There's really no way around this, and it's just not a great usage story.
Fortunately, in the JPA world, it's not common to actually directly inject the EntityManagerFactory due to the way that
@PersistenceContextworks.For this reason, it's actually reasonable for users to configure and return a Local(Container)EntityManagerFactoryBean from a
@Beanmethod - it has no real downside, because that@Beanmethod will probably never be referenced for injection purposes.This is a minor concession - it would be nice to tell users that it's never necessary to return a FactoryBean from a
@Beanmethod, but considering the alternative, this is probably an acceptable exception. As mentioned above, #12965 will round this support out with the introduction of@EnableLoadTimeWeaving, for JPA implementations (EclipseLink) that depend on it.For future reference, I've committed the fully functioning branch of work to https://github.com/cbeams/spring-framework/tree/SPR-8128.