Commit Graph

25 Commits

Author SHA1 Message Date
Chris Beams 9e8259198f Introduce (Annotation)SessionFactoryBuilder types
Large refactoring of existing *SessionFactoryBean hierarchy designed to
support configuration of Hibernate SessionFactory objects within
@Configuration class @Bean methods without forcing use of a
FactoryBean type, which is generally discouraged due to awkwardness
of programming model and lifecycle issues.  Refactored and new types
include:

    * Removal of AbstractSessionFactoryBean, replacing it with
      SessionFactoryBeanSupport abstract base class

    * Introduction of SessionFactoryBuilder and
      AnnotationSessionFactoryBuilder types, both direct subclasses of
      SessionFactoryBuilderSupport. These types are intended for direct
      use within @Bean methods. They expose method-chainable set*
      methods allowing for concise and convenient use. See JavaDoc
      on both types for usage examples.

    * LocalSessionFactoryBean and AnnotationSessionFactoryBean types are
      now subclasses, respectively, of the *Builder types above.

LSFB and ASFB backward-compatibility has been maintained almost
entirely. The one exception is that there is no longer a protected
convertHibernateAccessException() method available in the hierarchy.
This method was not likely often used anyway and has been replaced
by the new (and public) setPersistenceExceptionTranslator() which
accepts instances of type HibernateExceptionTranslator as introduced in
SPR-8076.

LSFB and ASFB setter method signatures have changed. They no longer
return void in standard JavaBeans style but rather, and due to extending
the *Builder types above, return the 'this' reference. This posed a
problem because the Spring container has to date been unable to detect
and provide dependency injection against non-void returning setter
methods. This limitation was due to the way that the default JavaBeans
Introspector class and its getBeanInfo() method works, and prompted the
introduction and intergration of ExtendedBeanInfo, already completed in
SPR-8079. So have no concern if you notice this signature change - it
all works.

Certain deprecations have been made:

    * All LSFB/ASFB methods related to Hibernate's CacheProvider SPI,
      reflecting its deprecation in Hibernate 3.3 in favor of the new
      RegionFactory SPI. Note these methods have been preserved only
      on the FactoryBean types. The new *SessionFactoryBuilder
      supertypes do not expose CacheProvider services at all.

    * All protected LSFB/ASFB methods that accept a Hibernate
      Configuration parameter, such as newSessionFactory(Configuration),
      postProcessMappings(Configuration) and
      postProcessConfiguration(Configuation), in favor of no-arg methods
      with the same names. Due to the nature of the hierarchy
      refactoring mentioned above, the Configuration instance is always
      available when these methods are called, thus no need to pass it
      in as a parameter.

In the process, our approach to automatic detection of Hibernate dialect
has been improved (it was in fact broken before). Thanks to James
Roper for his suggestion in SPR-7936 as to how to fix this.

See HibernateSessionFactoryConfigurationTests as a starting point for
understanding the new builder-style approach to SessionFactory creation.
Note especially use of the SessionFactoryBuilder#doWithConfiguration
method which allows for direct programmatic configuration of the Native
Hibernate (Annotation)Configuration API.

As a final note, AnnotationConfiguration has been deprecated in
Hibernate 3.6, and great pains have been taken to ensure that users
of any supported Hibernate version (3.2 -> 3.6) will never need to
(a) cast from Configuration to AnnotationConfiguration or (b)
experience deprecation warnings due to being forced to use the
AnnotationConfiguration API. Explore the JavaDoc around the
doWithConfiguration() method and HibernateConfigurationCallback type
for complete details.

Issue: SPR-8066, SPR-7936, SPR-8076, SPR-8098

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4147 50f2f4bb-b051-0410-bef5-90022cba6387
2011-03-31 12:29:12 +00:00
Sam Brannen 924b8e11ea [SPR-7850][SPR-7851] Upgraded to JUnit 4.8.1 and TestNG 5.12.1; added changelog entries for 3.1.0.M1.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3838 50f2f4bb-b051-0410-bef5-90022cba6387
2010-12-30 08:00:58 +00:00
Chris Beams 258a40a209 Fix .integration-tests build path errors
Add .expression as a build path dependency to satisfy imports in
Spr7538Tests.java

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3799 50f2f4bb-b051-0410-bef5-90022cba6387
2010-11-15 19:15:29 +00:00
Chris Beams 45e5b46fc2 Merge 3.1.0 development branch into trunk
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:

    git merge -s recursive -Xtheirs --no-commit env

No merge conflicts, but did need to

    git rm spring-build

prior to committing.

With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch.  3.1.0 snapshots will be available
per the usual nightly CI build from trunk.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3782 50f2f4bb-b051-0410-bef5-90022cba6387
2010-10-25 19:48:20 +00:00
Costin Leau 9a188fd461 SPR-7071
+ fix some Eclipse classpath entries

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3234 50f2f4bb-b051-0410-bef5-90022cba6387
2010-04-08 06:39:41 +00:00
Chris Beams f86e3bcfd2 Updated Eclipse .classpath to aspectj 1.6.8
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2920 50f2f4bb-b051-0410-bef5-90022cba6387
2010-02-04 13:45:14 +00:00
Juergen Hoeller 5560f45f35 fixed dependencies
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2562 50f2f4bb-b051-0410-bef5-90022cba6387
2009-12-03 13:15:33 +00:00
Sam Brannen 5b2a0f422e Updated Eclipse classpath regarding javax.inject and javax.validation.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2136 50f2f4bb-b051-0410-bef5-90022cba6387
2009-10-16 10:16:25 +00:00
Ramnivas Laddad b987b115ca Updated Groovy version for Eclipse project to mathc ivy.xml
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2029 50f2f4bb-b051-0410-bef5-90022cba6387
2009-09-28 20:56:13 +00:00
Juergen Hoeller a65d974b14 initial JSR-330 injection support
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1894 50f2f4bb-b051-0410-bef5-90022cba6387
2009-09-15 12:00:55 +00:00
Juergen Hoeller 4354ffd683 updated to CGLIB 2.2 and EHCache 1.6.2
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1830 50f2f4bb-b051-0410-bef5-90022cba6387
2009-09-07 18:04:27 +00:00
Keith Donald 2422565f07 fixed broken classpaths for ehcache and junit
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1796 50f2f4bb-b051-0410-bef5-90022cba6387
2009-09-02 16:29:43 +00:00
Juergen Hoeller a521abefcc updated dependencies
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1791 50f2f4bb-b051-0410-bef5-90022cba6387
2009-08-31 11:25:54 +00:00
Mark Fisher d7b321e413 updated aspectj weaver version in .classpath files to match ivy.xml configuration
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1609 50f2f4bb-b051-0410-bef5-90022cba6387
2009-07-24 20:09:01 +00:00
Sam Brannen aef72ba508 [SPR-5895] Upgraded to EasyMock 2.5.1.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1462 50f2f4bb-b051-0410-bef5-90022cba6387
2009-07-03 09:32:15 +00:00
Sam Brannen 887f8b3c10 [SPR-5887] Upgraded to JUnit 4.6.0.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1461 50f2f4bb-b051-0410-bef5-90022cba6387
2009-07-02 18:07:55 +00:00
Sam Brannen ae464e40c6 [SPR-5888] Upgrading to TestNG 5.9.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1458 50f2f4bb-b051-0410-bef5-90022cba6387
2009-07-02 16:03:31 +00:00
Sam Brannen 5705ad0305 Repairing Eclipse classpaths and Ivy config:
- org.apache.openjpa -> 1.1.0
 - com.sun.syndication -> 1.0.0
 - javax.el -> 1.0.0

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1395 50f2f4bb-b051-0410-bef5-90022cba6387
2009-06-18 11:36:04 +00:00
Scott Andrews a7784bf36d updating Eclipse .classpath settings for Freemarker 2.3.15 upgrade
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1058 50f2f4bb-b051-0410-bef5-90022cba6387
2009-04-23 14:13:03 +00:00
Colin Sampaleanu 9ae9763ab4 forgot to update eclipse project when updating hibernate versions
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@984 50f2f4bb-b051-0410-bef5-90022cba6387
2009-04-13 05:25:57 +00:00
Scott Andrews 89af3cf91d updating eclipse classpath settings
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@845 50f2f4bb-b051-0410-bef5-90022cba6387
2009-03-27 14:21:04 +00:00
Chris Beams 7f82764cb2 + Updated all projects to use the re-introduced org.springframework.asm instead of org.objectweb.asm (.java, template.mf, ivy.xml, and .classpath files have been updated)
+ Finished support for @Import, including detection of circular imports


git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@775 50f2f4bb-b051-0410-bef5-90022cba6387
2009-03-21 19:00:57 +00:00
Chris Beams b53b6be61a + Removed old testsuite.iml (favor integration-testsuite.iml)
+ Updated integration-tests/.classpath to point to javax.jdo 2.1.0 instead of 2.0.0


git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@717 50f2f4bb-b051-0410-bef5-90022cba6387
2009-03-03 00:02:18 +00:00
Scott Andrews 26a43a0fee updating eclipse settings and classpaths
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@569 50f2f4bb-b051-0410-bef5-90022cba6387
2009-01-21 23:02:43 +00:00
Chris Beams 91d7b44c47 renamed .testsuite -> .integration-tests
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@492 50f2f4bb-b051-0410-bef5-90022cba6387
2008-12-20 09:36:46 +00:00