Commit Graph

192 Commits

Author SHA1 Message Date
Chris Beams 5c27a04210 Automatically close SessionFactory objects
SessionFactory objects created by
SessionFactoryBuilderSupport#buildSessionFactory are now DisposableBean
proxies that call SessionFactory#close and release any threadlocal
DataSource object.

This is the same behavior that has always occurred during LSFBean and
ASFBean destruction lifecycles (and still does). This destruction logic
has now been factored out into
SessionFactoryBuilderSupport#closeHibernateSessionFactory such that all
SFB types can reuse it easily.

Note that LSFBean and ASFBean are subclasses, respectively, of SFBuilder
and ASFBuilder and they each must disable the DisposableBean proxying in
order to avoid duplicate attempts at closing the SessionFactory. See
the implementations of wrapSessionFactoryIfNeccesary() for details.

Issue: SPR-8114
2011-04-26 10:15:30 +00:00
Chris Beams fadfc76443 All SFBuilder setters return 'this' & use varargs
Touch up a few setter methods across the SessionFactoryBuilder
hierarchy that were still returning void.

Use varargs... syntax wherever possible.
2011-03-31 14:28:30 +00:00
Chris Beams f5768fe00b 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
2011-03-31 12:29:12 +00:00
Chris Beams b0b1116f4b Propagate wrapped exception in SessionFactoryUtils
Improve stack traces in certain Hibernate failure cases by properly
chaining the cause exception.

Issue: SPR-7933
2011-03-31 12:07:30 +00:00
Chris Beams 6809b234b1 Introduce HibernateExceptionTranslator
Designed to allow persistence exception translation of
HibernateException types without being forced to use
LocalSessionFactoryBean types.

Committed now in support of the forthcoming introduction of
*SessionFactoryBuilder types.

Issue: SPR-8076
2011-03-31 12:06:58 +00:00
Sam Brannen daa074734f [SPR-8092] cleaning up ignored and broken ORM tests; suppressing warnings; fixed Eclipse classpath for tests. 2011-03-28 18:16:45 +00:00
Sam Brannen 726564c84d Polishing and fixed broken support for @IfProfileValue in AbstractJpaTests (even though it's deprecated). 2011-03-28 17:23:48 +00:00
Chris Beams 2f7c2230f0 Include license.txt and notice.txt in module JARs 2011-02-09 06:56:40 +00:00
Sam Brannen b130a36af7 [SPR-7850][SPR-7851] Upgraded to JUnit 4.8.1 and TestNG 5.12.1; added changelog entries for 3.1.0.M1. 2010-12-30 08:00:58 +00:00
Chris Beams f480333d31 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.
2010-10-25 19:48:20 +00:00
Juergen Hoeller 4c154d3cab AnnotationSessionFactoryBean's "postProcessConfiguration" is non-final now (because of Hibernate 3.6; SPR-7581) 2010-09-29 13:22:24 +00:00
Juergen Hoeller f848e5081d updated version statement in javadoc 2010-09-08 22:48:03 +00:00
Juergen Hoeller 91a53a36ec LocalSessionFactoryBean's "entityCacheStrategies" works with region names on Hibernate 3.6 as well 2010-09-08 22:45:58 +00:00
Juergen Hoeller e56cfb8173 consistent use of JDK 1.5's ThreadLocal.remove() over ThreadLocal.set(null), preventing leaks (SPR-7441) 2010-09-01 17:17:25 +00:00
Ben Hale 7730e76c06 Publishing license and notice files 2010-08-23 13:17:31 +00:00
Arjen Poutsma dbfa049e1e Prepping for 3.0.5 2010-08-19 11:04:04 +00:00
Juergen Hoeller 0aec5efb56 polishing 2010-08-15 23:01:10 +00:00
Juergen Hoeller 72da237474 FilterDefinitionFactoryBean supports Hibernate 3.6.0.beta1 as well 2010-07-27 00:04:23 +00:00
Juergen Hoeller 96b9cf6ca9 DefaultJdoDialect supports JDO 3.0 query timeout facility (as supported by DataNucleus 2.1) 2010-07-08 11:47:30 +00:00
Arjen Poutsma b31c34ed7d Upgrading version to 3.0.4 2010-06-15 14:18:29 +00:00
Juergen Hoeller e12fbd3e2b avoid EntityManager close() exception through isOpen() check (SPR-7215) 2010-06-08 11:06:02 +00:00
Juergen Hoeller 928f5423af avoid EntityManager close() exception through isOpen() check (SPR-7215) 2010-06-08 10:21:05 +00:00
Juergen Hoeller 11bb7264a2 properly return null from getPersistenceUnitInfo again (SPR-7055) 2010-05-12 08:46:55 +00:00
Juergen Hoeller 2a19148eed changed "javax.persistence.criteria" import to an explicit Import-Package declaration (SPR-6636) 2010-04-15 22:16:17 +00:00
David Syer eb7f8309e2 Update version in POMs to 3.0.3 2010-04-15 10:26:14 +00:00
Costin Leau 688dd1a018 SPR-7071
+ fix some Eclipse classpath entries
2010-04-08 06:39:41 +00:00
Juergen Hoeller 4ee6735376 DefaultPersistenceUnitManager's getPersistenceUnitInfo method has 2.5 compatible signature again (SPR-7055) 2010-04-06 15:38:40 +00:00
Juergen Hoeller 6aa0e62597 compatibility with Hibernate 3.5 final 2010-04-01 11:37:35 +00:00
Juergen Hoeller 29ab58c4d8 ResourcePatternUtils provides plain PathMatchingResourcePatternResolver in case of a null ResourceLoader 2010-04-01 10:35:49 +00:00
Juergen Hoeller b370969690 added public "validateDatabaseSchema" method to Hibernate LocalSessionFactoryBean (SPR-3212) 2010-03-24 09:36:01 +00:00
Juergen Hoeller 7da13e7ad1 compatibility with OpenJPA 2.0 (support for persistence.xml versioning; SPR-6975) 2010-03-12 23:10:06 +00:00
Juergen Hoeller 0aee6e9f5b use target factory's ClassLoader in case of a raw EntityManagerFactory (SPR-6733) 2010-03-04 11:13:28 +00:00
Juergen Hoeller ef227c5d01 HibernateJpaDialect borrows JDBC Connection on demand (supporting aggressive release; SPR-6895) 2010-02-23 16:13:04 +00:00
David Syer 1a351db6e0 Update Central POMs to 3.0.2 2010-02-21 15:32:18 +00:00
Costin Leau 8d0bb00188 + make use or property placeholders inside template.mf 2010-02-19 09:43:22 +00:00
Juergen Hoeller cef44f6d53 made PersistenceAnnotationBeanPostProcessor's JNDI API references optional - for compatibility with Google App Engine (SPR-6679) 2010-02-11 11:36:33 +00:00
Juergen Hoeller ef024db318 polishing 2010-02-10 21:29:13 +00:00
Juergen Hoeller b25dc7cc55 compatibility with Hibernate 3.5 beta 4 (SPR-6804, SPR-6805) 2010-02-06 16:15:12 +00:00
Costin Leau 0fd4a45070 + upgrade to AspectJ 1.6.8
+ externalize some of the jar versions
+ align the versions of some dependencies between pom.xml and ivy.xml
2010-02-04 11:46:21 +00:00
Costin Leau fab29dfee7 + add explicit dependency on commons-pool to prevent version 1.3 from being used (since it contains a memory leak) 2010-02-04 10:05:54 +00:00
Juergen Hoeller 5f5e7c3262 polishing 2010-02-01 14:51:54 +00:00
Juergen Hoeller db71811c5a SharedEntityManagerCreator's EntityManager proxies are fully serializable now (SPR-6684) 2010-02-01 14:48:18 +00:00
Juergen Hoeller bcfef8a4e1 support for JPA 2.0 TypedQuery interface and query vendor interfaces (SPR-6733) 2010-01-21 12:04:26 +00:00
Juergen Hoeller 1b6f3f1f22 Query call chaining works with shared EntityManager proxy outside of transaction as well (SPR-6726) 2010-01-20 15:39:17 +00:00
Juergen Hoeller a6769d60c0 fixed support for JPA 2.0 persistence schema (SPR-6711) 2010-01-18 19:26:52 +00:00
Juergen Hoeller 7a792f6c23 fixed support for JPA 2.0 persistence schema (SPR-6711) 2010-01-18 19:17:52 +00:00
David Syer b077d5ba97 SPR-6678: fix poms for 3.0.1 2010-01-13 11:07:08 +00:00
Juergen Hoeller 0ba8375546 full support for JPA 2.0 PersistenceUnitInfo SPI (for compatibility with Hibernate 3.5 beta 3; SPR-6408) 2010-01-12 12:39:56 +00:00
Juergen Hoeller e328083d11 updated manifest for new JPA 2.0 criteria package (SPR-6636) 2010-01-05 12:50:22 +00:00
Juergen Hoeller e1d5c7310a updated JPA 2.0 support to the final spec (supporting the "getCriteriaBuilder" method) 2009-12-10 21:42:48 +00:00
David Syer 1202f67cc8 SPR-5327: tweak the ivy.xml so that commons-logging is a separate configuration. It already comes out as optional in the generated poms (including core), which isn't great, but I can't see what is causing that 2009-12-04 18:25:31 +00:00
Juergen Hoeller 0d413c7e36 reverted schema update implementation for Hibernate 3.2 compatibility (SPR-6509) 2009-12-04 17:19:47 +00:00
David Syer b7e37ddb07 SPR-5327: tidy up Maven dependencies (keeping commons-logging) 2009-11-30 12:57:11 +00:00
David Syer 1a06b6a0ab SPR-5327: tidy up Maven dependencies (keeping commons-logging) 2009-11-30 12:56:25 +00:00
Juergen Hoeller cc0bd730eb polishing 2009-11-27 01:34:56 +00:00
Juergen Hoeller 34d4e3cbe0 refined Hibernate version range 2009-11-26 16:09:48 +00:00
Juergen Hoeller 1cf0c12674 restored Hibernate 3.2 compatibility (SPR-6387) 2009-11-26 11:08:22 +00:00
Juergen Hoeller 46cd083976 added chaining-capable "add" method to MutablePropertyValues 2009-11-19 22:30:35 +00:00
Juergen Hoeller eb0b4f0cbd added support for Hibernate 3.3 RegionFactory cache SPI to LocalSessionFactoryBean (SPR-6387) 2009-11-19 15:39:11 +00:00
Juergen Hoeller 86934e2403 added SQL String and related context to translated JDBCException messages (SPR-6304) 2009-11-12 15:25:32 +00:00
Juergen Hoeller 155f6b1aa1 polishing 2009-11-12 02:27:31 +00:00
Thomas Risberg 076b912f05 removed filter for classes from the JPA providers package for EclipseLink (SPR-6040) 2009-11-07 19:46:46 +00:00
Keith Donald c8fd4a45fc more eclipse compile errors 2009-10-30 19:59:31 +00:00
David Syer 2978a4d0eb SPR-6160: resolved by referring to 'future release' instead of 2.5 2009-10-27 11:59:59 +00:00
Juergen Hoeller 54221500c1 fixed PersistenceInjectionTests 2009-10-20 18:30:55 +00:00
Juergen Hoeller 94533976d0 full compliance with the JSR-330 TCK 2009-10-20 18:18:25 +00:00
Arjen Poutsma cafc106ccc Renamed org.springframework.instrument.classloading module to org.springframework.instrument.tomcat 2009-09-25 12:51:58 +00:00
Juergen Hoeller 09e6a85edd fixed overview files 2009-09-25 08:47:18 +00:00
Mark Pollack c6cd1a528e SPR-6119 - Add slf4j dependency back to orm's pom.xml but in test scope as it is needed to run tests that use Hibernate
SPR-5956 - Remove commons-logging dependency definitions in pom.xml for all but spring-core so as to make exclusion rule easier for user who use slf4j
2009-09-25 05:16:55 +00:00
Juergen Hoeller cd1df84d7d removed slf4j dependency (not used in Spring itself; SPR-6119) 2009-09-24 23:16:35 +00:00
Juergen Hoeller 60acaf5671 updated dependencies 2009-09-24 22:55:21 +00:00
Mark Pollack 4f94f45ec4 pom maintenance 2009-09-21 07:37:30 +00:00
Juergen Hoeller ee1c68ead4 polishing 2009-09-08 22:35:55 +00:00
Juergen Hoeller 45dc856993 Jpa/JdoTransactionManager passes resolved timeout into Jpa/JdoDialect's beginTransaction; HibernateJpaDialect applies timeout onto native Hibernate Transaction before begin call (SPR-5195) 2009-09-08 22:35:32 +00:00
Juergen Hoeller 57f90ad4ef polishing 2009-09-07 18:07:17 +00:00
Juergen Hoeller 8754f0bc85 updated dependencies 2009-08-31 11:25:54 +00:00
Juergen Hoeller 83289cb8b0 updated JPA 2.0 compatibility to EclipseLink 2.0.0.M7 2009-08-27 00:51:47 +00:00
Juergen Hoeller ce3c72f8c2 compatibility with Hibernate 3.5 beta 1 2009-08-26 15:20:53 +00:00
Mark Pollack 3081396c15 pom maintenance - changes needed to run inside eclipse via m2eclipse 2009-08-06 06:04:56 +00:00
Mark Pollack 97e3b5ca8c SPR-5976 - Upgrade POMS to JUnit 4.6 2009-08-05 17:48:53 +00:00
Arjen Poutsma 3d29023ef3 Updating POMs to contain Junit & EasyMock version numbers. Apparently, the maven ant tasks cannot resolve our parent pom. 2009-08-03 09:21:44 +00:00
Mark Fisher 1bfb26e4b2 updated aspectj weaver version in .classpath files to match ivy.xml configuration 2009-07-24 20:09:01 +00:00
Chris Beams 9163d8043b updated .jms dependency on junit 4.6.0 from test->runtime to test->compile. touched all org.eclipse.jdt.core.prefs (during the process of importing the projects). only the date comments within each have changed. 2009-07-15 07:26:31 +00:00
Mark Pollack 69422e771f SPR-5619 - (OpenSessionInViewTests, ClassUtilTests fixed)
Update org.sf.web/.classpath to refer to tiles 2.1.2
2009-07-10 03:30:12 +00:00
Mark Pollack 0c16554e23 SPR-5803 and additional POM maintenance/development 2009-07-09 19:38:07 +00:00
Sam Brannen 620c9b1f96 [SPR-5895] Upgraded to EasyMock 2.5.1. 2009-07-03 09:32:15 +00:00
Sam Brannen 8bfb56c75b [SPR-5887] Upgraded to JUnit 4.6.0. 2009-07-02 18:07:55 +00:00
Chris Beams a9696c7282 RESOLVED - SPR-5523: Replace all 'package.html' artifacts with 'package-info.java'
* Applied patch submitted by Carlos Zuniga
2009-06-01 04:14:22 +00:00
Juergen Hoeller a5c324f934 Hibernate AnnotationSessionFactoryBean detects Hibernate's special @Entity annotation too (SPR-5787) 2009-05-28 11:25:39 +00:00
Sam Brannen af56f6497c Updated regarding generics; fixed typos. 2009-05-25 09:04:05 +00:00
Juergen Hoeller e70d2ce14c polishing 2009-05-20 00:31:00 +00:00
Juergen Hoeller bbd69da37f updated all Spring Framework OSGI manifests to list unversioned imports explicitly; relaxed several OSGi bundle dependencies to optional and extended version ranges 2009-05-12 16:43:15 +00:00
Sam Brannen a6a8b29d19 Fixed typo in JavaDoc 2009-05-04 06:02:59 +00:00
Juergen Hoeller bc9b256179 fixed "org.hibernate.ejb" version range 2009-04-19 19:36:26 +00:00
Thomas Risberg 1facd45c5e switched to use XInclude 2009-04-14 21:37:40 +00:00
Mark Pollack 362629d03b Change version from 3.0.0.M3 to 3.0.0.BUILD-SNAPSHOT (again) 2009-04-09 14:38:35 +00:00
Mark Pollack 8f76197485 Change version from 3.0.0.M3 to 3.0.0.BUILD-SNAPSHOT 2009-04-03 14:03:48 +00:00
Mark Pollack 351fba1a04 POM maintenance
Place parent pom in publicly accessible directory (org.sf.spring-parent).  
Create a component list pom in org.sf.spring-library.
2009-03-29 09:56:38 +00:00
Mark Pollack a9c8ba407c POM maintenance 2009-03-28 01:41:11 +00:00
Mark Pollack 5f21cbd9da POM maintenance 2009-03-27 21:28:51 +00:00