Hibernate SVN: r14456 - core/trunk/core/src/main/java/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:26:18 -0400 (Tue, 18 Mar 2008)
New Revision: 14456
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java
Log:
prep 3.3.0.CR1 release
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java 2008-03-18 07:25:39 UTC (rev 14455)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java 2008-03-18 07:26:18 UTC (rev 14456)
@@ -153,7 +153,7 @@
*/
public final class Environment {
- public static final String VERSION = "3.2 cr3";
+ public static final String VERSION = "3.3.0.CR1";
/**
* <tt>ConnectionProvider</tt> implementor to use when obtaining connections
16 years, 8 months
Hibernate SVN: r14455 - core/trunk/documentation/manual/src/main/docbook/en-US.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:25:39 -0400 (Tue, 18 Mar 2008)
New Revision: 14455
Modified:
core/trunk/documentation/manual/src/main/docbook/en-US/Hibernate_Reference.xml
Log:
prep 3.3.0.CR1 release
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/Hibernate_Reference.xml
===================================================================
--- core/trunk/documentation/manual/src/main/docbook/en-US/Hibernate_Reference.xml 2008-03-18 07:24:14 UTC (rev 14454)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/Hibernate_Reference.xml 2008-03-18 07:25:39 UTC (rev 14455)
@@ -15,7 +15,7 @@
~ Red Hat Author(s): Steve Ebersole
-->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY versionNumber "3.3.0.alpha1">
+ <!ENTITY versionNumber "3.3.0.CR1">
<!ENTITY copyrightYear "2004">
<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
]>
16 years, 8 months
Hibernate SVN: r14454 - in core/trunk: src/site and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:24:14 -0400 (Tue, 18 Mar 2008)
New Revision: 14454
Added:
core/trunk/src/site/apt/documentation.apt
Removed:
core/trunk/readme.txt
Modified:
core/trunk/changelog.txt
core/trunk/src/site/apt/index.apt
core/trunk/src/site/site.xml
Log:
prep 3.3.0.CR1 release
Modified: core/trunk/changelog.txt
===================================================================
--- core/trunk/changelog.txt 2008-03-18 07:23:06 UTC (rev 14453)
+++ core/trunk/changelog.txt 2008-03-18 07:24:14 UTC (rev 14454)
@@ -6,6 +6,203 @@
more about each case.
+Changes in version 3.3.0.CR1 (2008.03.18)
+-------------------------------------------
+
+** Bug
+ * [HHH-1312] - Unclosed ResultSet when using Identity
+ * [HHH-1396] - Table.validateColumns fails on valid column
+ * [HHH-1569] - Immutable Natural Id check fails with ArrayIndexOutOfBounds in some cases
+ * [HHH-1593] - Infinite loop/StackOverflow when calling configuration.setListener(null)
+ * [HHH-1753] - DB2Dialect.getCurrentTimestampSQLFunctionName() uses Oracle syntax
+ * [HHH-1916] - param values in generator element should be trimmed during HbmBinding
+ * [HHH-1920] - Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3).
+ * [HHH-1956] - Interceptor.afterTransactionCompletion not called with JTATransaction (CacheSynchronization.hibernateTransaction not set)
+ * [HHH-2159] - NullPointerException in FromElement#findIntendedAliasedFromElementBasedOnCrazyJPARequirements with 'hibernate.query.jpaql_strict_compliance' enabled
+ * [HHH-2164] - Minor bug in section "20.1.1. Customizing the schema"
+ * [HHH-2200] - Memory leak in AbstractBatcher with Generated Properties
+ * [HHH-2320] - Regression: optional properties under a <join> tag no longer update properly
+ * [HHH-2503] - AbstractEntityPersister swallows JDBCExceptions in processGeneratedProperties
+ * [HHH-2513] - Abusive WARN logged during deserialization of replicated SessionFactory
+ * [HHH-2542] - NullPointerException in TypeFactory.replaceAssociations for ComponentType
+ * [HHH-2553] - New LoadContexts Implementation causing possible performance degradation
+ * [HHH-2593] - Keyword UNION is prefixed with "this_." in filter conditions
+ * [HHH-2616] - No event is fired on Collection recreate/remove/update action
+ * [HHH-2627] - Generated properties leak prepared statements in Hibernate 3.2.3 and higher.
+ * [HHH-2631] - Leaking PreparedStatement and ResultSet via CollectionLoadContext instances maintained in Map collectionLoadContexts in LoadContexts
+ * [HHH-2711] - PropertyAccessException with backref and <composite-map-key/>
+ * [HHH-2726] - spelling o your CLASSPATH
+ * [HHH-2728] - Calling session.clear() while retrieving objects via an iterator will cause a "LazyInitializationException - No Session" by the CGLIBLazyInitializer
+ * [HHH-2788] - Oracl8iDialect No Dialect mapping for JDBC type 91
+ * [HHH-2795] - CollectionLoadContexts for empy collections are not removed until PersistenceContext.clear()
+ * [HHH-2816] - DefaultFlushEntityEventListener.checkNaturalId() causes extra SELECTs on read-only entities
+ * [HHH-2833] - insert-select query fails with NPE when select includes join
+ * [HHH-2857] - schemaSupport for HSQLDialect remote connections doesn't work
+ * [HHH-2861] - cascade="delete-orphan,all" is ignored
+ * [HHH-2863] - testsuite fix-ups for maven and/or directory changes
+ * [HHH-2864] - Merging a detached instance with a new child in a unidirectional one-to-many association fails if the parent was previously loaded as a proxy
+ * [HHH-2892] - skip up-to-date checks of query cache for natural-id only if immutable
+ * [HHH-2928] - optimizers for enhanced id generators should be synchronized against multi-threaded access
+ * [HHH-2948] - QueryStatistics.executionMinTime always = 0
+ * [HHH-3111] - WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus() implemented incorrect
+ * [HHH-3140] - Region prefix ignored for entities and collections
+
+** Deprecation
+ * [HHH-2755] - Wrong "jsdk.jar" referenced in the tutorial
+
+** Improvement
+ * [HHH-1786] - JTASessionContext.CleanupSynch does not remove sessions from currentSessionMap
+ * [HHH-2048] - Incomplete MappingException at org.hibernate.mapping.SimpleValue
+ * [HHH-2156] - Section 19.3, "Managing the caches" doesn't document CacheMode.IGNORE
+ * [HHH-2533] - redesign Cache/CacheProviders
+ * [HHH-2662] - Workaround PostgreSQL issues in testsuite
+ * [HHH-2663] - Map java.sql.Types.REAL to Hibernate FloatType for auto-discovery stuff
+ * [HHH-2665] - Split Oracle9Dialect into Oracle9iDialect and Oracle10gDialect
+ * [HHH-2669] - Unequivocally map MySQL LOB types to the LONG variant
+ * [HHH-2682] - support for auto-discovery of H2 dialect
+ * [HHH-2696] - Consider migrating to slf4j
+ * [HHH-2761] - Handle null and empty string consistently in PropertiesHelper
+ * [HHH-2778] - TransactionManagerLookup implementation for Bitronix Transaction Manager
+ * [HHH-2789] - Section 19.2 of the documentation does not show OSCache as supporting clusters. It does.
+ * [HHH-2822] - timestamp extraction functions for SAPDBDialect
+ * [HHH-2826] - IS [NOT] NULL checks with component values
+ * [HHH-2859] - Introduce a 'Work' API for user to perform JDBC work
+ * [HHH-3131] - Add a method to ActionQueue to tell whether there are currently entries in the executions collection
+
+** New Feature
+ * [HHH-1] - Optimize Hibernate for the bulk insertion of related entities
+ * [HHH-2555] - Create new RegionFactory for JBossCache
+ * [HHH-2884] - Provide a sessionFactory close event or hook for the event listeners
+
+** Patch
+ * [HHH-952] - Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
+ * [HHH-2070] - Expand DB2Dialect auto-discovery support (Martin Renner)
+ * [HHH-2519] - Schema dropping not documented with hibernate.hbm2ddl.auto=create
+ * [HHH-2630] - Hibernate Dialect is not auto-detected for Sybase ASE and DB2 (Shelley McGowan)
+ * [HHH-2758] - Patch IngresDialect based on certification
+ * [HHH-2839] - Don't use dummy dual table for hsqldb (David Bala?ic)
+ * [HHH-2849] - Better error logging in IdentifierGeneratorFactory (Antony Stubbs)
+ * [HHH-2957] - ActionQueue Insertion sort performance degrades exponentially (Jay Erb)
+ * [HHH-3084] - DialectFactory detection of Ingres metadata (Michael Leo)
+
+** Task
+ * [HHH-2702] - Officially move to JDK 1.4
+ * [HHH-2704] - Migrate to Maven2 for build
+
+
+Changes in version 3.2.6 (2008.02.07)
+-------------------------------------------
+
+** Bug
+ * [HHH-925] - DetachedCriteria.createCriteria not working with alias
+ * [HHH-1312] - Unclosed ResultSet when using Identity
+ * [HHH-1329] - SchemaValidator fail when views are involved
+ * [HHH-1593] - Infinite loop/StackOverflow when calling configuration.setListener(null)
+ * [HHH-1685] - DetachedCriteria doesn't create alias on subcriteria
+ * [HHH-1753] - DB2Dialect.getCurrentTimestampSQLFunctionName() uses Oracle syntax
+ * [HHH-1916] - param values in generator element should be trimmed during HbmBinding
+ * [HHH-1956] - Interceptor.afterTransactionCompletion not called with JTATransaction (CacheSynchronization.hibernateTransaction not set)
+ * [HHH-2016] - Oracle9Dialect registers last_day() function as "lastday"
+ * [HHH-2159] - NullPointerException in FromElement#findIntendedAliasedFromElementBasedOnCrazyJPARequirements with 'hibernate.query.jpaql_strict_compliance' enabled
+ * [HHH-2200] - Memory leak in AbstractBatcher with Generated Properties
+ * [HHH-2261] - Setting hibernate.hbm2ddl.auto=validate causes problems on mySQL with numeric fields
+ * [HHH-2320] - Regression: optional properties under a <join> tag no longer update properly
+ * [HHH-2503] - AbstractEntityPersister swallows JDBCExceptions in processGeneratedProperties
+ * [HHH-2542] - NullPointerException in TypeFactory.replaceAssociations for ComponentType
+ * [HHH-2593] - Keyword UNION is prefixed with "this_." in filter conditions
+ * [HHH-2598] - Mapping a collection of entities from two different classes with the same collection name results in duplicate backref property exception if collection keys are not null
+ * [HHH-2616] - No event is fired on Collection recreate/remove/update action
+ * [HHH-2627] - Generated properties leak prepared statements in Hibernate 3.2.3 and higher.
+ * [HHH-2728] - Calling session.clear() while retrieving objects via an iterator will cause a "LazyInitializationException - No Session" by the CGLIBLazyInitializer
+ * [HHH-2788] - Oracl8iDialect No Dialect mapping for JDBC type 91
+ * [HHH-2795] - CollectionLoadContexts for empy collections are not removed until PersistenceContext.clear()
+ * [HHH-2816] - DefaultFlushEntityEventListener.checkNaturalId() causes extra SELECTs on read-only entities
+ * [HHH-2833] - insert-select query fails with NPE when select includes join
+ * [HHH-2857] - schemaSupport for HSQLDialect remote connections doesn't work
+ * [HHH-2861] - cascade="delete-orphan,all" is ignored
+ * [HHH-2864] - Merging a detached instance with a new child in a unidirectional one-to-many association fails if the parent was previously loaded as a proxy
+ * [HHH-2892] - skip up-to-date checks of query cache for natural-id only if immutable
+ * [HHH-2928] - optimizers for enhanced id generators should be synchronized against multi-threaded access
+ * [HHH-2948] - QueryStatistics.executionMinTime always = 0
+
+** Improvement
+ * [HHH-1630] - duplicate property mapping - more details
+ * [HHH-1696] - Add outer join support for aliases on DetachedCriteria
+ * [HHH-2048] - Incomplete MappingException at org.hibernate.mapping.SimpleValue
+ * [HHH-2682] - support for auto-discovery of H2 dialect
+ * [HHH-2761] - Handle null and empty string consistently in PropertiesHelper
+ * [HHH-2822] - timestamp extraction functions for SAPDBDialect
+ * [HHH-2826] - IS [NOT] NULL checks with component values
+ * [HHH-2852] - Better error messages when schema validation fails
+
+** Patch
+ * [HHH-952] - Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
+ * [HHH-2070] - Expand DB2Dialect auto-discovery support (Martin Renner)
+ * [HHH-2839] - Don't use dummy dual table for hsqldb (David Bala?ic)
+ * [HHH-2849] - Better error logging in IdentifierGeneratorFactory (Antony Stubbs)
+ * [HHH-2957] - ActionQueue Insertion sort performance degrades exponentially (Jay Erb)
+ * [HHH-3084] - DialectFactory detection of Ingres metadata (Michael Leo)
+
+** Task
+ * [HHH-2559] - http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd needs to be updated
+ * [HHH-3085] - Remove connector.jar (unnecessary library)
+ * [HHH-3086] - Remove jdbc2_0-stdext.jar (unnecessary library)
+
+
+Changes in version 3.2.5 (2007.07.31)
+-------------------------------------------
+
+** Bug
+ * [HHH-1116] - batch-size typo
+ * [HHH-1561] - Missing " in Documentation for H3, Chapter 15.8
+ * [HHH-1569] - Immutable Natural Id check fails with ArrayIndexOutOfBounds in some cases
+ * [HHH-1694] - Documentation Outdated: "10.4.4. Queries in native SQL"
+ * [HHH-2180] - minordocumentation error in hbm xml
+ * [HHH-2201] - session.iterate() does not exist
+ * [HHH-2267] - A copy/paste mistake in the documentation for <schemavalidator> ant task
+ * [HHH-2334] - Documentation error in section 5.1.3
+ * [HHH-2420] - Error in 2.5. Contextual Sessions
+ * [HHH-2502] - The second level caching documentation states that ehcache is not distributed.
+ * [HHH-2631] - Leaking PreparedStatement and ResultSet via CollectionLoadContext instances maintained in Map collectionLoadContexts in LoadContexts
+ * [HHH-2649] - Batcher configuration parameter incorrectly documented
+ * [HHH-2711] - PropertyAccessException with backref and <composite-map-key/>
+ * [HHH-2713] - duplicated phrase in docs "of the of the"
+ * [HHH-2714] - Three typos in code examples
+ * [HHH-2719] - adddress --> address
+ * [HHH-2720] - Monetory --> Monetary
+
+** Improvement
+ * [HHH-1022] - incomplete documentation in _README.txt in the lib directory
+ * [HHH-1682] - Improve the description of differences between save() and persist()
+ * [HHH-2048] - Incomplete MappingException at org.hibernate.mapping.SimpleValue
+ * [HHH-2417] - Update book on Hibernate reference
+ * [HHH-2418] - Refer HSQL DB website in chapter 1.2.3
+ * [HHH-2487] - Typo in "5.1.7. version (optional)"
+ * [HHH-2550] - Update API Class in 10.4.3. Criteria queries
+ * [HHH-2662] - Workaround PostgreSQL issues in testsuite
+ * [HHH-2663] - Map java.sql.Types.REAL to Hibernate FloatType for auto-discovery stuff
+ * [HHH-2665] - Split Oracle9Dialect into Oracle9iDialect and Oracle10gDialect
+
+** Patch
+ * [HHH-2520] - Miscellaneous config doc spelling fixes
+ * [HHH-2630] - Hibernate Dialect is not auto-detected for Sybase ASE and DB2 (Shelley McGowan)
+ * [HHH-2758] - Patch IngresDialect based on certification
+
+** Task
+ * [HHH-2551] - Deprecate org.hibernate.criterion.Expression
+ * [HHH-2566] - Replace usages of FlushMode.NEVER with FlushMode.MANUAL
+ * [HHH-2567] - Update reference to use FlushMode.MANUAL
+ * [HHH-2568] - Hibernate javadoc overview refering wrong classes and packages
+
+
+Changes in version 3.2.4.sp1 (2007.05.18)
+-------------------------------------------
+
+** Bug
+ * [HHH-2605] - Since 3.2.4 no value specified for row id
+ * [HHH-2613] - LockMode.FORCE on non versioned entity leads to NPE
+
+
Changes in version 3.2.4 (2007.05.09)
-------------------------------------------
Deleted: core/trunk/readme.txt
===================================================================
--- core/trunk/readme.txt 2008-03-18 07:23:06 UTC (rev 14453)
+++ core/trunk/readme.txt 2008-03-18 07:24:14 UTC (rev 14454)
@@ -1,54 +0,0 @@
-Hibernate - Relational Persistence for Idiomatic Java
-=====================================================
-version 3.2 cr3, July 7, 2006
-
-Instructions
-------------
-Unzip to installation directory.
-
-See index.html in the doc/reference directory.
-
-Required jars are distributed in the lib subdirectory.
-
-Latest Documentation:
-
- http://hibernate.org
-
-Bug Reports:
-
- Hibernate JIRA (preferred)
- hibernate-devel(a)lists.sourceforge.net
-
-Free Technical Support:
-
- http://forum.hibernate.org
-
-Commercial Support and Training:
-
- http://hibernate.org/SupportTraining
-
-
-Get Up And Running Quick
-------------------------
-Demo:
-
- (1) copy your JDBC driver to the lib directory
- (2) edit etc/hibernate.properties
- (3) run "ant eg" or "build eg"
- (4) browse the sourcecode in eg/org/hibernate/auction
-
-Tests:
-
- (1) copy your JDBC driver to the lib directory
- (2) edit etc/hibernate.properties
- (3) run "ant junitreport" or "build junitreport"
- (4) see test_output/index.html
-
-
-Other Stuff
------------
-This software is distributed under the terms of the FSF Lesser Gnu
-Public License (see lgpl.txt).
-
-This product includes software developed by the Apache Software
-Foundation (http://www.apache.org/).
Added: core/trunk/src/site/apt/documentation.apt
===================================================================
--- core/trunk/src/site/apt/documentation.apt (rev 0)
+++ core/trunk/src/site/apt/documentation.apt 2008-03-18 07:24:14 UTC (rev 14454)
@@ -0,0 +1,33 @@
+ ------
+ Documentation
+ ------
+ Steve Ebersole
+ ------
+ 17 March 2008
+ ------
+
+~~ Hibernate, Relational Persistence for Idiomatic Java
+~~
+~~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+~~ indicated by the @author tags or express copyright attribution
+~~ statements applied by the authors. All third-party contributions are
+~~ distributed under license by Red Hat Middleware LLC.
+~~
+~~ This copyrighted material is made available to anyone wishing to use, modify,
+~~ copy, or redistribute it subject to the terms and conditions of the GNU
+~~ Lesser General Public License, as published by the Free Software Foundation.
+~~
+~~ This program is distributed in the hope that it will be useful,
+~~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+~~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+~~for more details.
+~~
+~~ You should have received a copy of the GNU Lesser General Public License
+~~ along with this distribution; if not, write to:
+~~ Free Software Foundation, Inc.
+~~ 51 Franklin Street, Fifth Floor
+~~ Boston, MA 02110-1301 USA
+
+Hibernate Core - Documentation
+
+ Coming Soon... intended as a central aggregation of documentation and resource information.
\ No newline at end of file
Modified: core/trunk/src/site/apt/index.apt
===================================================================
--- core/trunk/src/site/apt/index.apt 2008-03-18 07:23:06 UTC (rev 14453)
+++ core/trunk/src/site/apt/index.apt 2008-03-18 07:24:14 UTC (rev 14454)
@@ -4,11 +4,11 @@
Steve Ebersole
------
20 July 2007
- ------ß
+ ------
~~ Hibernate, Relational Persistence for Idiomatic Java
~~
-~~ Copyright (c) $today.year, Red Hat Middleware LLC or third-party contributors as
+~~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
~~ indicated by the @author tags or express copyright attribution
~~ statements applied by the authors. All third-party contributions are
~~ distributed under license by Red Hat Middleware LLC.
Modified: core/trunk/src/site/site.xml
===================================================================
--- core/trunk/src/site/site.xml 2008-03-18 07:23:06 UTC (rev 14453)
+++ core/trunk/src/site/site.xml 2008-03-18 07:24:14 UTC (rev 14454)
@@ -8,11 +8,11 @@
<version position="left"/>
<publishDate position="navigation-bottom" format="yyyy-MM-dd"/>
-
+<!--
<poweredBy>
<logo name="Maven" href="http://maven.apache.org/" img="images/maven-button-4.png"/>
- </poweredBy>
-
+ </poweredBy
+-->
<body>
<head>
@@ -27,9 +27,7 @@
<menu name="Overview">
<item name="Introduction" href="index.html"/>
- <item name="Getting Started" href="quickstart.html"/>
<item name="Documentation" href="documentation.html"/>
- <item name="FAQs" href="faq.html"/>
</menu>
<menu name="Information">
16 years, 8 months
Hibernate SVN: r14453 - core/trunk/core/src/main/java/org/hibernate/property.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:23:06 -0400 (Tue, 18 Mar 2008)
New Revision: 14453
Modified:
core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java
Log:
HHH-2268 : handle bridged return types for getters (ROLLBACK)
Modified: core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java 2008-03-18 07:12:54 UTC (rev 14452)
+++ core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java 2008-03-18 07:23:06 UTC (rev 14453)
@@ -316,8 +316,8 @@
Method[] methods = theClass.getDeclaredMethods();
for (int i=0; i<methods.length; i++) {
- // only carry on if the method has no parameters and is not a bridge
- if ( methods[i].getParameterTypes().length == 0 && !methods[i].isBridge() ) {
+ // only carry on if the method has no parameters
+ if ( methods[i].getParameterTypes().length == 0 ) {
String methodName = methods[i].getName();
// try "get"
16 years, 8 months
Hibernate SVN: r14452 - in core/trunk: core/src/main/java/org/hibernate/cfg and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:12:54 -0400 (Tue, 18 Mar 2008)
New Revision: 14452
Added:
core/trunk/core/src/main/java/org/hibernate/SessionFactoryObserver.java
core/trunk/core/src/main/java/org/hibernate/event/Destructible.java
core/trunk/testsuite/src/test/java/org/hibernate/test/events/
core/trunk/testsuite/src/test/java/org/hibernate/test/events/CallbackTest.java
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
core/trunk/core/src/main/java/org/hibernate/event/EventListeners.java
core/trunk/core/src/main/java/org/hibernate/event/Initializable.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
Log:
HHH-2884 : SessionFactory close notifications
Added: core/trunk/core/src/main/java/org/hibernate/SessionFactoryObserver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/SessionFactoryObserver.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/SessionFactoryObserver.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -0,0 +1,48 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Allows reaction to basic {@link SessionFactory} occurrences.
+ *
+ * @author Steve Ebersole
+ */
+public interface SessionFactoryObserver extends Serializable {
+ /**
+ * Callback to indicate that the given factory has been created and is now ready for use.
+ *
+ * @param factory The factory initialized.
+ */
+ public void sessionFactoryCreated(SessionFactory factory);
+
+ /**
+ * Callback to indicate that the given factory has been closed. Care should be taken
+ * in how (if at all) the passed factory reference is used since it is closed.
+ *
+ * @param factory The factory closed.
+ */
+ public void sessionFactoryClosed(SessionFactory factory);
+}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2008-03-18 07:02:20 UTC (rev 14451)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -26,11 +26,15 @@
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.dom4j.Attribute;
import org.dom4j.DocumentException;
import org.dom4j.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
import org.hibernate.EmptyInterceptor;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
@@ -38,7 +42,7 @@
import org.hibernate.MappingException;
import org.hibernate.MappingNotFoundException;
import org.hibernate.SessionFactory;
-import org.hibernate.proxy.EntityNotFoundDelegate;
+import org.hibernate.SessionFactoryObserver;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.function.SQLFunction;
@@ -56,10 +60,16 @@
import org.hibernate.event.LockEventListener;
import org.hibernate.event.MergeEventListener;
import org.hibernate.event.PersistEventListener;
+import org.hibernate.event.PostCollectionRecreateEventListener;
+import org.hibernate.event.PostCollectionRemoveEventListener;
+import org.hibernate.event.PostCollectionUpdateEventListener;
import org.hibernate.event.PostDeleteEventListener;
import org.hibernate.event.PostInsertEventListener;
import org.hibernate.event.PostLoadEventListener;
import org.hibernate.event.PostUpdateEventListener;
+import org.hibernate.event.PreCollectionRecreateEventListener;
+import org.hibernate.event.PreCollectionRemoveEventListener;
+import org.hibernate.event.PreCollectionUpdateEventListener;
import org.hibernate.event.PreDeleteEventListener;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreLoadEventListener;
@@ -67,12 +77,6 @@
import org.hibernate.event.RefreshEventListener;
import org.hibernate.event.ReplicateEventListener;
import org.hibernate.event.SaveOrUpdateEventListener;
-import org.hibernate.event.PreCollectionRecreateEventListener;
-import org.hibernate.event.PreCollectionRemoveEventListener;
-import org.hibernate.event.PreCollectionUpdateEventListener;
-import org.hibernate.event.PostCollectionUpdateEventListener;
-import org.hibernate.event.PostCollectionRemoveEventListener;
-import org.hibernate.event.PostCollectionRecreateEventListener;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.impl.SessionFactoryImpl;
@@ -87,6 +91,7 @@
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.UniqueKey;
+import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.secure.JACCConfiguration;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.tool.hbm2ddl.TableMetadata;
@@ -95,14 +100,11 @@
import org.hibernate.util.ArrayHelper;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.ConfigHelper;
+import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.SerializationHelper;
import org.hibernate.util.StringHelper;
import org.hibernate.util.XMLHelper;
-import org.hibernate.util.PropertiesHelper;
-import org.w3c.dom.Document;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
/**
* An instance of <tt>Configuration</tt> allows the application
@@ -158,6 +160,8 @@
protected final SettingsFactory settingsFactory;
+ private SessionFactoryObserver sessionFactoryObserver;
+
protected void reset() {
classes = new HashMap();
imports = new HashMap();
@@ -1301,7 +1305,8 @@
this,
mapping,
settings,
- getInitializedEventListeners()
+ getInitializedEventListeners(),
+ sessionFactoryObserver
);
}
@@ -2164,4 +2169,12 @@
public void addSqlFunction(String functionName, SQLFunction function) {
sqlFunctions.put( functionName, function );
}
+
+ public SessionFactoryObserver getSessionFactoryObserver() {
+ return sessionFactoryObserver;
+ }
+
+ public void setSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver) {
+ this.sessionFactoryObserver = sessionFactoryObserver;
+ }
}
Added: core/trunk/core/src/main/java/org/hibernate/event/Destructible.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/Destructible.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/event/Destructible.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -0,0 +1,37 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.event;
+
+/**
+ * Contract for listeners which require notification of SessionFactory closing,
+ * presumably to destroy internal state.
+ *
+ * @author Steve Ebersole
+ */
+public interface Destructible {
+ /**
+ * Notification of {@link org.hibernate.SessionFactory} shutdown.
+ */
+ public void cleanup();
+}
Modified: core/trunk/core/src/main/java/org/hibernate/event/EventListeners.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/EventListeners.java 2008-03-18 07:02:20 UTC (rev 14451)
+++ core/trunk/core/src/main/java/org/hibernate/event/EventListeners.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -1,4 +1,26 @@
-//$Id: EventListeners.java 8416 2005-10-16 13:27:54Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.event;
import java.io.Serializable;
@@ -132,7 +154,70 @@
return clazz;
}
- public LoadEventListener[] getLoadEventListeners() {
+ private static interface ListenerProcesser {
+ public void processListener(Object listener);
+ }
+
+ private void processListeners(ListenerProcesser processer) {
+ Field[] fields = getClass().getDeclaredFields();
+ for ( int i = 0; i < fields.length; i++ ) {
+ try {
+ final Object field = fields[i].get( this );
+ if ( field instanceof Object[] ) {
+ final Object[] listeners = ( Object[] ) field;
+ int length = listeners.length;
+ for ( int index = 0 ; index < length ; index++ ) {
+ processer.processListener( listeners[index ] );
+ }
+ }
+ }
+ catch ( Exception e ) {
+ throw new AssertionFailure( "could not process listeners" );
+ }
+ }
+ }
+
+ /**
+ * Call {@link Initializable#initialize} on any listeners that implement the
+ * {@link Initializable} interface.
+ *
+ * @param cfg The configuration.
+ */
+ public void initializeListeners(final Configuration cfg) {
+ try {
+ processListeners(
+ new ListenerProcesser() {
+ public void processListener(Object listener) {
+ if ( listener instanceof Initializable ) {
+ ( ( Initializable ) listener ).initialize( cfg );
+ }
+ }
+ }
+ );
+ }
+ catch ( Exception e ) {
+ throw new AssertionFailure("could not init listeners");
+ }
+ }
+
+ public void destroyListeners() {
+ try {
+ processListeners(
+ new ListenerProcesser() {
+ public void processListener(Object listener) {
+ if ( listener instanceof Destructible ) {
+ ( ( Destructible ) listener ).cleanup();
+ }
+ }
+ }
+ );
+ }
+ catch ( Exception e ) {
+ throw new AssertionFailure("could not init listeners");
+ }
+ }
+
+ public LoadEventListener[] getLoadEventListeners() {
return loadEventListeners;
}
@@ -387,40 +472,7 @@
public void setPreUpdateEventListeners(PreUpdateEventListener[] preUpdateEventListener) {
this.preUpdateEventListeners = preUpdateEventListener;
}
-
- /**
- * Call <tt>initialize()</tt> on any listeners that implement
- * <tt>Initializable</tt>.
- * @see Initializable
- */
- public void initializeListeners(Configuration cfg) {
- Field[] fields = getClass().getDeclaredFields();
- for ( int i = 0; i < fields.length; i++ ) {
- Object[] listeners;
- try {
- Object listener = fields[i].get(this);
- if (listener instanceof Object[]) {
- listeners = (Object[]) listener;
- }
- else {
- continue;
- }
- }
- catch (Exception e) {
- throw new AssertionFailure("could not init listeners");
- }
- int length = listeners.length;
- for (int index = 0 ; index < length ; index++) {
- Object listener = listeners[index];
- if (listener instanceof Initializable ) {
- ( (Initializable) listener ).initialize(cfg);
- }
- }
-
- }
- }
-
public PostDeleteEventListener[] getPostCommitDeleteEventListeners() {
return postCommitDeleteEventListeners;
}
Modified: core/trunk/core/src/main/java/org/hibernate/event/Initializable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/Initializable.java 2008-03-18 07:02:20 UTC (rev 14451)
+++ core/trunk/core/src/main/java/org/hibernate/event/Initializable.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -1,11 +1,34 @@
-//$Id: Initializable.java 7793 2005-08-10 05:06:40Z oneovthafew $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.event;
import org.hibernate.cfg.Configuration;
/**
- * An event listener that requires access to mappings to
- * initialize state at initialization time.
+ * An event listener that requires access to mappings to initialize state at
+ * initialization time.
+ *
* @author Gavin King
*/
public interface Initializable {
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-03-18 07:02:20 UTC (rev 14451)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -16,7 +16,6 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
@@ -24,6 +23,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.hibernate.AssertionFailure;
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.EntityMode;
@@ -34,17 +34,17 @@
import org.hibernate.QueryException;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
-import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
+import org.hibernate.SessionFactoryObserver;
import org.hibernate.cache.CacheKey;
+import org.hibernate.cache.CollectionRegion;
+import org.hibernate.cache.EntityRegion;
import org.hibernate.cache.QueryCache;
+import org.hibernate.cache.Region;
import org.hibernate.cache.UpdateTimestampsCache;
-import org.hibernate.cache.Region;
-import org.hibernate.cache.EntityRegion;
-import org.hibernate.cache.CollectionRegion;
-import org.hibernate.cache.impl.CacheDataDescriptionImpl;
-import org.hibernate.cache.access.EntityRegionAccessStrategy;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+import org.hibernate.cache.impl.CacheDataDescriptionImpl;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings;
@@ -62,6 +62,7 @@
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.query.QueryPlanCache;
+import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
import org.hibernate.event.EventListeners;
import org.hibernate.exception.SQLExceptionConverter;
import org.hibernate.id.IdentifierGenerator;
@@ -116,6 +117,9 @@
*/
public final class SessionFactoryImpl implements SessionFactory, SessionFactoryImplementor {
+ private static final Logger log = LoggerFactory.getLogger(SessionFactoryImpl.class);
+ private static final IdentifierGenerator UUID_GENERATOR = new UUIDHexGenerator();
+
private final String name;
private final String uuid;
@@ -144,22 +148,18 @@
private final transient CurrentSessionContext currentSessionContext;
private final transient EntityNotFoundDelegate entityNotFoundDelegate;
private final transient SQLFunctionRegistry sqlFunctionRegistry;
-
+ private final transient SessionFactoryObserver observer;
+
private final QueryPlanCache queryPlanCache = new QueryPlanCache( this );
private transient boolean isClosed = false;
-
- private static final IdentifierGenerator UUID_GENERATOR = new UUIDHexGenerator();
-
- private static final Logger log = LoggerFactory.getLogger(SessionFactoryImpl.class);
-
public SessionFactoryImpl(
Configuration cfg,
Mapping mapping,
Settings settings,
- EventListeners listeners)
- throws HibernateException {
+ EventListeners listeners,
+ SessionFactoryObserver observer) throws HibernateException {
log.info("building session factory");
@@ -169,7 +169,13 @@
this.settings = settings;
this.sqlFunctionRegistry = new SQLFunctionRegistry(settings.getDialect(), cfg.getSqlFunctions());
this.eventListeners = listeners;
- this.filters = new HashMap();
+ this.observer = observer != null ? observer : new SessionFactoryObserver() {
+ public void sessionFactoryCreated(SessionFactory factory) {
+ }
+ public void sessionFactoryClosed(SessionFactory factory) {
+ }
+ };
+ this.filters = new HashMap();
this.filters.putAll( cfg.getFilterDefinitions() );
if ( log.isDebugEnabled() ) {
@@ -382,6 +388,8 @@
};
}
this.entityNotFoundDelegate = entityNotFoundDelegate;
+
+ this.observer.sessionFactoryCreated( this );
}
public QueryPlanCache getQueryPlanCache() {
@@ -766,6 +774,11 @@
*/
public void close() throws HibernateException {
+ if ( isClosed ) {
+ log.trace( "already closed" );
+ return;
+ }
+
log.info("closing");
isClosed = true;
@@ -810,6 +823,8 @@
schemaExport.drop( false, true );
}
+ observer.sessionFactoryClosed( this );
+ eventListeners.destroyListeners();
}
public void evictEntity(String entityName, Serializable id) throws HibernateException {
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/events/CallbackTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/events/CallbackTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/events/CallbackTest.java 2008-03-18 07:12:54 UTC (rev 14452)
@@ -0,0 +1,101 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.events;
+
+import java.util.Set;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.SessionFactoryObserver;
+import org.hibernate.HibernateException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.event.DeleteEventListener;
+import org.hibernate.event.Destructible;
+import org.hibernate.event.Initializable;
+import org.hibernate.event.DeleteEvent;
+import org.hibernate.junit.functional.FunctionalTestCase;
+
+/**
+ * CallbackTest implementation
+ *
+ * @author Steve Ebersole
+ */
+public class CallbackTest extends FunctionalTestCase {
+ private TestingObserver observer = new TestingObserver();
+ private TestingListener listener = new TestingListener();
+
+ public CallbackTest(String string) {
+ super( string );
+ }
+
+ public String[] getMappings() {
+ return new String[0];
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setSessionFactoryObserver( observer );
+ cfg.getEventListeners().setDeleteEventListeners( new DeleteEventListener[] { listener } );
+ }
+
+ public void testCallbacks() {
+ assertTrue( "observer not notified of creation", observer.creationCount == 1 );
+ assertTrue( "listener not notified of creation", listener.initCount == 1 );
+
+ sfi().close();
+
+ assertTrue( "observer not notified of close", observer.closedCount == 1 );
+ assertTrue( "listener not notified of close", listener.destoryCount == 1 );
+ }
+
+ private static class TestingObserver implements SessionFactoryObserver {
+ private int creationCount = 0;
+ private int closedCount = 0;
+
+ public void sessionFactoryCreated(SessionFactory factory) {
+ creationCount++;
+ }
+
+ public void sessionFactoryClosed(SessionFactory factory) {
+ closedCount++;
+ }
+ }
+
+ private static class TestingListener implements DeleteEventListener, Initializable, Destructible {
+ private int initCount = 0;
+ private int destoryCount = 0;
+
+ public void initialize(Configuration cfg) {
+ initCount++;
+ }
+
+ public void cleanup() {
+ destoryCount++;
+ }
+
+ public void onDelete(DeleteEvent event) throws HibernateException {
+ }
+
+ public void onDelete(DeleteEvent event, Set transientEntities) throws HibernateException {
+ }
+ }
+}
16 years, 8 months
Hibernate SVN: r14451 - core/trunk/testing/src/main/java/org/hibernate/test/tm.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 03:02:20 -0400 (Tue, 18 Mar 2008)
New Revision: 14451
Modified:
core/trunk/testing/src/main/java/org/hibernate/test/tm/TransactionManagerLookupImpl.java
Log:
HHH-1786 : more WebSphere JTA garbage;
copyright headers
clean-up
Modified: core/trunk/testing/src/main/java/org/hibernate/test/tm/TransactionManagerLookupImpl.java
===================================================================
--- core/trunk/testing/src/main/java/org/hibernate/test/tm/TransactionManagerLookupImpl.java 2008-03-18 05:54:15 UTC (rev 14450)
+++ core/trunk/testing/src/main/java/org/hibernate/test/tm/TransactionManagerLookupImpl.java 2008-03-18 07:02:20 UTC (rev 14451)
@@ -25,6 +25,7 @@
import java.util.Properties;
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.hibernate.transaction.TransactionManagerLookup;
import org.hibernate.HibernateException;
@@ -42,4 +43,8 @@
public String getUserTransactionName() {
throw new UnsupportedOperationException( "jndi currently not implemented for these tests" );
}
+
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
}
16 years, 8 months
Hibernate SVN: r14450 - core/trunk/core/src/main/java/org/hibernate/context.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 01:54:15 -0400 (Tue, 18 Mar 2008)
New Revision: 14450
Modified:
core/trunk/core/src/main/java/org/hibernate/context/CurrentSessionContext.java
core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
core/trunk/core/src/main/java/org/hibernate/context/ManagedSessionContext.java
core/trunk/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java
Log:
copyright headers
Modified: core/trunk/core/src/main/java/org/hibernate/context/CurrentSessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/CurrentSessionContext.java 2008-03-18 05:48:53 UTC (rev 14449)
+++ core/trunk/core/src/main/java/org/hibernate/context/CurrentSessionContext.java 2008-03-18 05:54:15 UTC (rev 14450)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.context;
import org.hibernate.HibernateException;
@@ -5,8 +28,8 @@
import java.io.Serializable;
/**
- * Defines the contract for implementations which know how to
- * scope the notion of a {@link org.hibernate.SessionFactory#getCurrentSession() current session}.
+ * Defines the contract for implementations which know how to scope the notion
+ * of a {@link org.hibernate.SessionFactory#getCurrentSession() current session}.
* <p/>
* Implementations should adhere to the following:
* <ul>
@@ -22,7 +45,7 @@
* Note that there will be exactly one instance of the configured
* CurrentSessionContext implementation per {@link org.hibernate.SessionFactory}.
*
- * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ * @author Steve Ebersole
*/
public interface CurrentSessionContext extends Serializable {
/**
@@ -30,7 +53,7 @@
* by this implementation.
*
* @return The current session.
- * @throws org.hibernate.HibernateException Typically indicates an issue
+ * @throws HibernateException Typically indicates an issue
* locating or creating the current session.
*/
public org.hibernate.classic.Session currentSession() throws HibernateException;
Modified: core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-03-18 05:48:53 UTC (rev 14449)
+++ core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-03-18 05:54:15 UTC (rev 14450)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.context;
import org.hibernate.HibernateException;
@@ -48,13 +71,16 @@
this.factory = factory;
}
+ /**
+ * {@inheritDoc}
+ */
public Session currentSession() throws HibernateException {
TransactionManager transactionManager = factory.getTransactionManager();
if ( transactionManager == null ) {
throw new HibernateException( "No TransactionManagerLookup specified" );
}
- Transaction txn = null;
+ Transaction txn;
try {
txn = transactionManager.getTransaction();
if ( txn == null ) {
@@ -158,9 +184,15 @@
this.context = context;
}
+ /**
+ * {@inheritDoc}
+ */
public void beforeCompletion() {
}
+ /**
+ * {@inheritDoc}
+ */
public void afterCompletion(int i) {
context.currentSessionMap.remove( txn );
}
Modified: core/trunk/core/src/main/java/org/hibernate/context/ManagedSessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/ManagedSessionContext.java 2008-03-18 05:48:53 UTC (rev 14449)
+++ core/trunk/core/src/main/java/org/hibernate/context/ManagedSessionContext.java 2008-03-18 05:54:15 UTC (rev 14450)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.context;
import org.hibernate.classic.Session;
@@ -42,7 +65,7 @@
}
/**
- * @see CurrentSessionContext#currentSession
+ * {@inheritDoc}
*/
public Session currentSession() {
Session current = existingSession( factory );
Modified: core/trunk/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java 2008-03-18 05:48:53 UTC (rev 14449)
+++ core/trunk/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java 2008-03-18 05:54:15 UTC (rev 14450)
@@ -42,9 +42,9 @@
* The {@link #buildOrObtainSession}, {@link #isAutoCloseEnabled},
* {@link #isAutoFlushEnabled}, {@link #getConnectionReleaseMode}, and
* {@link #buildCleanupSynch} methods are all provided to allow easy
- * subclassing (for long- running session scenarios, for example).
+ * subclassing (for long-running session scenarios, for example).
*
- * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ * @author Steve Ebersole
*/
public class ThreadLocalSessionContext implements CurrentSessionContext {
@@ -70,6 +70,9 @@
this.factory = factory;
}
+ /**
+ * {@inheritDoc}
+ */
public final Session currentSession() throws HibernateException {
Session current = existingSession( factory );
if (current == null) {
@@ -94,6 +97,11 @@
&& ! ( Proxy.getInvocationHandler( session ) instanceof TransactionProtectionWrapper ) );
}
+ /**
+ * Getter for property 'factory'.
+ *
+ * @return Value for property 'factory'.
+ */
protected SessionFactoryImplementor getFactory() {
return factory;
}
@@ -244,9 +252,15 @@
this.factory = factory;
}
+ /**
+ * {@inheritDoc}
+ */
public void beforeCompletion() {
}
+ /**
+ * {@inheritDoc}
+ */
public void afterCompletion(int i) {
unbind( factory );
}
@@ -260,6 +274,9 @@
this.realSession = realSession;
}
+ /**
+ * {@inheritDoc}
+ */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
// If close() is called, guarantee unbind()
@@ -310,6 +327,11 @@
}
}
+ /**
+ * Setter for property 'wrapped'.
+ *
+ * @param wrapped Value to set for property 'wrapped'.
+ */
public void setWrapped(Session wrapped) {
this.wrappedSession = wrapped;
}
16 years, 8 months
Hibernate SVN: r14449 - in core/trunk/core/src/main/java/org/hibernate: transaction and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-18 01:48:53 -0400 (Tue, 18 Mar 2008)
New Revision: 14449
Modified:
core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java
core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java
core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java
core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java
core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java
core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java
core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java
Log:
HHH-1786 : more WebSphere JTA garbage;
copyright headers
clean-up
Modified: core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -35,7 +35,7 @@
* the {@link #buildOrObtainSession()} method) for easier subclassing for custom
* JTA-based session tracking logic (like maybe long-session semantics).
*
- * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ * @author Steve Ebersole
*/
public class JTASessionContext implements CurrentSessionContext {
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,8 +1,31 @@
-//$Id: BESTransactionManagerLookup.java 4388 2004-08-20 07:44:37Z oneovthafew $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
* A <tt>TransactionManager</tt> lookup strategy for Borland ES.
+ *
* @author Etienne Hardy
*/
public final class BESTransactionManagerLookup extends JNDITransactionManagerLookup {
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -3,15 +26,17 @@
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.hibernate.HibernateException;
/**
* TransactionManager lookup strategy for BTM
+ *
* @author Ludovic Orban
*/
public class BTMTransactionManagerLookup implements TransactionManagerLookup {
/**
- * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
+ * {@inheritDoc}
*/
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
@@ -26,9 +51,16 @@
}
/**
- * @see org.hibernate.transaction.TransactionManagerLookup#getUserTransactionName()
+ * {@inheritDoc}
*/
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
}
\ No newline at end of file
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CMTTransaction.java 9680 2006-03-22 23:47:31Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import javax.transaction.Status;
@@ -14,8 +36,13 @@
import org.hibernate.util.JTAHelper;
/**
- * Implements a basic transaction strategy for CMT transactions. All work is done
- * in the context of the container managed transaction.
+ * Implements a basic transaction strategy for CMT transactions. All work is
+ * done in the context of the container managed transaction.
+ * <p/>
+ * The term 'CMT' is potentially misleading here; the pertinent point simply
+ * being that the transactions are being managed by something other than the
+ * Hibernate transaction mechanism.
+ *
* @author Gavin King
*/
public class CMTTransaction implements Transaction {
@@ -32,6 +59,9 @@
this.transactionContext = transactionContext;
}
+ /**
+ * {@inheritDoc}
+ */
public void begin() throws HibernateException {
if (begun) {
return;
@@ -50,6 +80,9 @@
jdbcContext.afterTransactionBegin(this);
}
+ /**
+ * {@inheritDoc}
+ */
public void commit() throws HibernateException {
if (!begun) {
throw new TransactionException("Transaction not successfully started");
@@ -68,6 +101,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void rollback() throws HibernateException {
if (!begun) {
throw new TransactionException("Transaction not successfully started");
@@ -87,10 +123,18 @@
}
+ /**
+ * Getter for property 'transaction'.
+ *
+ * @return Value for property 'transaction'.
+ */
public javax.transaction.Transaction getTransaction() throws SystemException {
return transactionContext.getFactory().getTransactionManager().getTransaction();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isActive() throws TransactionException {
if (!begun) return false;
@@ -111,6 +155,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasRolledBack() throws TransactionException {
if (!begun) return false;
@@ -131,6 +178,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasCommitted() throws TransactionException {
if ( !begun ) return false;
@@ -151,6 +201,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void registerSynchronization(Synchronization sync) throws HibernateException {
try {
getTransaction().registerSynchronization(sync);
@@ -160,6 +213,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void setTimeout(int seconds) {
throw new UnsupportedOperationException("cannot set transaction timeout in CMT");
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CMTTransactionFactory.java 9595 2006-03-10 18:14:21Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -13,9 +35,8 @@
import javax.transaction.SystemException;
/**
- * Factory for <tt>CMTTransaction</tt>.
+ * Factory for {@link CMTTransaction} instances.
*
- * @see CMTTransaction
* @author Gavin King
*/
public class CMTTransactionFactory implements TransactionFactory {
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CacheSynchronization.java 9239 2006-02-08 22:34:34Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import javax.transaction.Status;
@@ -8,11 +30,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.hibernate.TransactionException;
import org.hibernate.jdbc.JDBCContext;
import org.hibernate.util.JTAHelper;
/**
+ * A JTA transaction synch used to allow the {@link org.hibernate.Session} to know about transaction
+ * events.
+ *
* @author Gavin King
*/
public final class CacheSynchronization implements Synchronization {
@@ -28,14 +54,16 @@
TransactionFactory.Context ctx,
JDBCContext jdbcContext,
Transaction transaction,
- org.hibernate.Transaction tx
- ) {
+ org.hibernate.Transaction tx) {
this.ctx = ctx;
this.jdbcContext = jdbcContext;
this.transaction = transaction;
this.hibernateTransaction = tx;
}
+ /**
+ * {@inheritDoc}
+ */
public void beforeCompletion() {
log.trace("transaction before completion callback");
@@ -77,6 +105,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void afterCompletion(int status) {
if ( log.isTraceEnabled() ) {
log.trace("transaction after completion callback, status: " + status);
@@ -92,6 +123,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String toString() {
return CacheSynchronization.class.getName();
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,8 +1,31 @@
-//$Id: JBossTransactionManagerLookup.java 8435 2005-10-18 16:23:33Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * A <tt>TransactionManager</tt> lookup strategy for JBoss
+ * A {@link TransactionManagerLookup} lookup strategy for JBoss AS.
+ *
* @author Gavin King
*/
public final class JBossTransactionManagerLookup extends JNDITransactionManagerLookup {
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,10 +1,31 @@
-//$Id: JDBCTransaction.java 9595 2006-03-10 18:14:21Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-
import javax.transaction.Status;
import javax.transaction.Synchronization;
@@ -17,10 +38,13 @@
import org.hibernate.jdbc.JDBCContext;
/**
- * Implements a basic transaction strategy for JDBC connections.This is the
- * default <tt>Transaction</tt> implementation used if none is explicitly
- * specified.
- * @author Anton van Straaten, Gavin King
+ * {@link Transaction} implementation based on transaction management through
+ * a JDBC {@link java.sql.Connection}.
+ * <p/>
+ * This the Hibernate's default transaction strategy.
+ *
+ * @author Anton van Straaten
+ * @author Gavin King
*/
public class JDBCTransaction implements Transaction {
@@ -43,6 +67,9 @@
this.transactionContext = transactionContext;
}
+ /**
+ * {@inheritDoc}
+ */
public void begin() throws HibernateException {
if (begun) {
return;
@@ -95,6 +122,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void commit() throws HibernateException {
if (!begun) {
throw new TransactionException("Transaction not successfully started");
@@ -143,6 +173,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void rollback() throws HibernateException {
if (!begun && !commitFailed) {
@@ -200,18 +233,30 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasRolledBack() {
return rolledBack;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasCommitted() {
return committed;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isActive() {
return begun && ! ( rolledBack || committed | commitFailed );
}
+ /**
+ * {@inheritDoc}
+ */
public void registerSynchronization(Synchronization sync) throws HibernateException {
if (sync==null) throw new NullPointerException("null Synchronization");
if (synchronizations==null) {
@@ -249,6 +294,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void setTimeout(int seconds) {
timeout = seconds;
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JDBCTransactionFactory.java 10013 2006-06-11 17:00:19Z gavin.king(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -9,31 +31,49 @@
import org.hibernate.jdbc.JDBCContext;
/**
- * Factory for <tt>JDBCTransaction</tt>.
- * @see JDBCTransaction
+ * Factory for {@link JDBCTransaction} instances.
+ *
* @author Anton van Straaten
*/
public final class JDBCTransactionFactory implements TransactionFactory {
+ /**
+ * {@inheritDoc}
+ */
public ConnectionReleaseMode getDefaultReleaseMode() {
return ConnectionReleaseMode.AFTER_TRANSACTION;
}
+ /**
+ * {@inheritDoc}
+ */
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
throws HibernateException {
return new JDBCTransaction( jdbcContext, transactionContext );
}
+ /**
+ * {@inheritDoc}
+ */
public void configure(Properties props) throws HibernateException {}
+ /**
+ * {@inheritDoc}
+ */
public boolean isTransactionManagerRequired() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean areCallbacksLocalToHibernateTransactions() {
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isTransactionInProgress(
JDBCContext jdbcContext,
Context transactionContext,
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,23 +1,56 @@
-//$Id: JNDITransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
import javax.naming.NamingException;
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.hibernate.HibernateException;
import org.hibernate.util.NamingHelper;
/**
- * Locates a <tt>TransactionManager</tt> in JNDI.
+ * Template implementation of {@link TransactionManagerLookup} where the
+ * underlying {@link TransactionManager} is available via JNDI lookup at the
+ * specified location - {@link #getName}.
+ *
* @author Gavin King
*/
public abstract class JNDITransactionManagerLookup implements TransactionManagerLookup {
/**
- * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(java.util.Properties)
+ * Get the JNDI namespace under wich we can locate the {@link TransactionManager}.
+ *
+ * @return The {@link TransactionManager} JNDI namespace
*/
+ protected abstract String getName();
+
+ /**
+ * {@inheritDoc}
+ */
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
try {
return (TransactionManager) NamingHelper.getInitialContext(props).lookup( getName() );
@@ -27,8 +60,13 @@
}
}
- protected abstract String getName();
-
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ // for sane JEE/JTA containers, the transaction itself functions as its identifier...
+ return transaction;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -3,15 +26,17 @@
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.hibernate.HibernateException;
/**
- * TransactionManager lookup strategy for JOTM
+ * {@link TransactionManagerLookup} strategy for JOTM
+ *
* @author Low Heng Sin
*/
public class JOTMTransactionManagerLookup implements TransactionManagerLookup {
/**
- * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
+ * {@inheritDoc}
*/
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
@@ -25,10 +50,19 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -3,10 +26,10 @@
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.hibernate.HibernateException;
/**
- * TransactionManager lookup strategy for JOnAS
- * @author ?
+ * {@link TransactionManagerLookup} strategy for JOnAS
*/
public class JOnASTransactionManagerLookup implements TransactionManagerLookup {
@@ -25,9 +48,18 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,7 +1,31 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * TransactionManager lookup strategy for JRun4
+ * {@link TransactionManagerLookup} strategy for JRun4 AS
+ *
* @author Joseph Bissen
*/
public class JRun4TransactionManagerLookup extends JNDITransactionManagerLookup {
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JTATransaction.java 9601 2006-03-11 18:17:43Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import javax.naming.InitialContext;
@@ -19,16 +41,20 @@
import org.hibernate.util.JTAHelper;
/**
- * Implements a basic transaction strategy for JTA transactions. Instances check to
- * see if there is an existing JTA transaction. If none exists, a new transaction
- * is started. If one exists, all work is done in the existing context. The
- * following properties are used to locate the underlying <tt>UserTransaction</tt>:
- * <br><br>
- * <table>
- * <tr><td><tt>hibernate.jndi.url</tt></td><td>JNDI initial context URL</td></tr>
- * <tr><td><tt>hibernate.jndi.class</tt></td><td>JNDI provider class</td></tr>
- * <tr><td><tt>jta.UserTransaction</tt></td><td>JNDI name</td></tr>
- * </table>
+ * {@link Transaction} implementation based on transaction management through
+ * a JTA {@link UserTransaction}. Similar to {@link CMTTransaction}, except
+ * here we are actually managing the transactions through the Hibernate
+ * transaction mechanism.
+ * <p/>
+ * Instances check to see if there is an existing JTA transaction. If none
+ * exists, a new transaction is started; if one exists, all work is done in the
+ * existing context. The following properties are used to locate the underlying
+ * {@link UserTransaction}:<ul>
+ * <li><tt>hibernate.jndi.url</tt> : JNDI initial context URL</li>
+ * <li><tt>hibernate.jndi.class</tt> : JNDI provider class</li>
+ * <li><tt>jta.UserTransaction</tt> : JNDI namespace</li>
+ * </ul>
+ *
* @author Gavin King
*/
public class JTATransaction implements Transaction {
@@ -70,6 +96,9 @@
log.debug("Obtained UserTransaction");
}
+ /**
+ * {@inheritDoc}
+ */
public void begin() throws HibernateException {
if (begun) {
return;
@@ -121,6 +150,9 @@
jdbcContext.afterTransactionBegin(this);
}
+ /**
+ * {@inheritDoc}
+ */
public void commit() throws HibernateException {
if (!begun) {
throw new TransactionException("Transaction not successfully started");
@@ -166,6 +198,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void rollback() throws HibernateException {
if (!begun && !commitFailed) {
throw new TransactionException("Transaction not successfully started");
@@ -236,6 +271,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasRolledBack() throws TransactionException {
//if (!begun) return false;
@@ -257,6 +295,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean wasCommitted() throws TransactionException {
//if (!begun || commitFailed) return false;
@@ -277,6 +318,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isActive() throws TransactionException {
if (!begun || commitFailed || commitSucceeded) return false;
@@ -297,6 +341,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void registerSynchronization(Synchronization sync) throws HibernateException {
if (getTransactionManager()==null) {
throw new IllegalStateException("JTA TransactionManager not available");
@@ -311,6 +358,11 @@
}
}
+ /**
+ * Getter for property 'transactionManager'.
+ *
+ * @return Value for property 'transactionManager'.
+ */
private TransactionManager getTransactionManager() {
return transactionContext.getFactory().getTransactionManager();
}
@@ -324,6 +376,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void setTimeout(int seconds) {
try {
ut.setTransactionTimeout(seconds);
@@ -333,6 +388,11 @@
}
}
+ /**
+ * Getter for property 'userTransaction'.
+ *
+ * @return Value for property 'userTransaction'.
+ */
protected UserTransaction getUserTransaction() {
return ut;
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JTATransactionFactory.java 10347 2006-08-24 15:37:11Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -10,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.HibernateException;
import org.hibernate.Transaction;
@@ -20,14 +43,13 @@
import org.hibernate.util.JTAHelper;
/**
- * Factory for <tt>JTATransaction</tt>.
+ * Factory for {@link JTATransaction} instances.
*
- * @see JTATransaction
* @author Gavin King
*/
public class JTATransactionFactory implements TransactionFactory {
- private static final Logger log = LoggerFactory.getLogger(JTATransactionFactory.class);
+ private static final Logger log = LoggerFactory.getLogger( JTATransactionFactory.class );
private static final String DEFAULT_USER_TRANSACTION_NAME = "java:comp/UserTransaction";
protected InitialContext context;
@@ -35,26 +57,30 @@
public void configure(Properties props) throws HibernateException {
try {
- context = NamingHelper.getInitialContext(props);
+ context = NamingHelper.getInitialContext( props );
}
- catch (NamingException ne) {
- log.error("Could not obtain initial context", ne);
+ catch ( NamingException ne ) {
+ log.error( "Could not obtain initial context", ne );
throw new HibernateException( "Could not obtain initial context", ne );
}
- utName = props.getProperty(Environment.USER_TRANSACTION);
+ utName = props.getProperty( Environment.USER_TRANSACTION );
- if (utName==null) {
- TransactionManagerLookup lookup = TransactionManagerLookupFactory.getTransactionManagerLookup(props);
- if (lookup!=null) utName = lookup.getUserTransactionName();
+ if ( utName == null ) {
+ TransactionManagerLookup lookup = TransactionManagerLookupFactory.getTransactionManagerLookup( props );
+ if ( lookup != null ) {
+ utName = lookup.getUserTransactionName();
+ }
}
- if (utName==null) utName = DEFAULT_USER_TRANSACTION_NAME;
+ if ( utName == null ) {
+ utName = DEFAULT_USER_TRANSACTION_NAME;
+ }
}
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
- throws HibernateException {
- return new JTATransaction(context, utName, jdbcContext, transactionContext);
+ throws HibernateException {
+ return new JTATransaction( context, utName, jdbcContext, transactionContext );
}
public ConnectionReleaseMode getDefaultReleaseMode() {
@@ -71,10 +97,10 @@
public boolean isTransactionInProgress(
JDBCContext jdbcContext,
- Context transactionContext,
- Transaction transaction) {
+ Context transactionContext,
+ Transaction transaction) {
try {
- // Essentially:
+ // Essentially:
// 1) If we have a local (Hibernate) transaction in progress
// and it already has the UserTransaction cached, use that
// UserTransaction to determine the status.
@@ -83,27 +109,27 @@
// 3) Finally, as the last resort, try to lookup the
// UserTransaction via JNDI and use that to determine the
// status.
- if ( transaction != null ) {
+ if ( transaction != null ) {
UserTransaction ut = ( ( JTATransaction ) transaction ).getUserTransaction();
- if ( ut != null ) {
- return JTAHelper.isInProgress( ut.getStatus() );
- }
- }
+ if ( ut != null ) {
+ return JTAHelper.isInProgress( ut.getStatus() );
+ }
+ }
- if ( jdbcContext.getFactory().getTransactionManager() != null ) {
- return JTAHelper.isInProgress( jdbcContext.getFactory().getTransactionManager().getStatus() );
- }
- else {
- try {
+ if ( jdbcContext.getFactory().getTransactionManager() != null ) {
+ return JTAHelper.isInProgress( jdbcContext.getFactory().getTransactionManager().getStatus() );
+ }
+ else {
+ try {
UserTransaction ut = ( UserTransaction ) context.lookup( utName );
- return ut != null && JTAHelper.isInProgress( ut.getStatus() );
+ return ut != null && JTAHelper.isInProgress( ut.getStatus() );
}
catch ( NamingException ne ) {
throw new TransactionException( "Unable to locate UserTransaction to check status", ne );
}
- }
+ }
}
- catch( SystemException se ) {
+ catch ( SystemException se ) {
throw new TransactionException( "Unable to check transaction status", se );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,7 +1,30 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * TransactionManagerLookup for the OC4J (Oracle) app-server.
+ * {@link TransactionManagerLookup} for the OC4J (Oracle) AS.
*
* @author Stijn Janssens
*/
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,20 +1,45 @@
-//$Id: OrionTransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * TransactionManager lookup strategy for Orion
+ * {@link TransactionManagerLookup} strategy for Orion
+ *
* @author Gavin King
*/
-public class OrionTransactionManagerLookup
-extends JNDITransactionManagerLookup {
+public class OrionTransactionManagerLookup extends JNDITransactionManagerLookup {
/**
- * @see org.hibernate.transaction.JNDITransactionManagerLookup#getName()
+ * {@inheritDoc}
*/
protected String getName() {
return "java:comp/UserTransaction";
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,28 +1,47 @@
-//$Id: ResinTransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * TransactionManager lookup strategy for Resin
+ * {@link TransactionManagerLookup} strategy for Resin
+ *
* @author Aapo Laakkonen
*/
-public class ResinTransactionManagerLookup
-extends JNDITransactionManagerLookup {
+public class ResinTransactionManagerLookup extends JNDITransactionManagerLookup {
/**
- * @see org.hibernate.transaction.JNDITransactionManagerLookup#getName()
+ * {@inheritDoc}
*/
protected String getName() {
return "java:comp/TransactionManager";
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
}
-
-
-
-
-
-
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,18 +1,47 @@
-//$Id: SunONETransactionManagerLookup.java 11274 2007-03-12 00:18:38Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
/**
- * TransactionManager lookup strategy for Sun ONE Application Server 7 and above
+ * {@link TransactionManagerLookup} strategy for Sun ONE Application Server 7 and above
*
- * @author Robert Davidson, Sanjeev Krishnan
+ * @author Robert Davidson
+ * @author Sanjeev Krishnan
* @author Emmanuel Bernard
*/
public class SunONETransactionManagerLookup extends JNDITransactionManagerLookup {
+ /**
+ * {@inheritDoc}
+ */
protected String getName() {
return "java:appserver/TransactionManager";
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: TransactionFactory.java 9595 2006-03-10 18:14:21Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -6,23 +28,31 @@
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.HibernateException;
import org.hibernate.Transaction;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.jdbc.JDBCContext;
-import org.hibernate.engine.SessionFactoryImplementor;
/**
- * An abstract factory for <tt>Transaction</tt> instances. Concrete implementations
- * are specified by <tt>hibernate.transaction.factory_class</tt>.<br>
- * <br>
+ * Contract for generating Hibernate {@link Transaction} instances.
+ * <p/>
+ * The concrete implementation to be used is specified by the
+ * {@link org.hibernate.cfg.Environment#TRANSACTION_STRATEGY} configuration
+ * setting.
+ * <p/>
* Implementors must be threadsafe and should declare a public default constructor.
+ *
* @see Transaction
*
- * @author Anton van Straaten, Gavin King
+ * @author Anton van Straaten
+ * @author Gavin King
*/
public interface TransactionFactory {
+ /**
+ * Callback mechanism; a context is always a {@link org.hibernate.Session}
+ * in the Hibernate usage.
+ */
public static interface Context {
public SessionFactoryImplementor getFactory();
-// public boolean isOpen();
public boolean isClosed();
public boolean isFlushModeNever();
@@ -39,35 +69,41 @@
* @param jdbcContext The jdbc context to which the transaction belongs
* @param context The contract regarding the context in which this transaction will operate.
* @return Transaction
- * @throws HibernateException
+ * @throws HibernateException Indicates a problem generating a transaction instance
*/
public Transaction createTransaction(JDBCContext jdbcContext, Context context) throws HibernateException;
/**
* Configure from the given properties.
- * @param props
- * @throws HibernateException
+ *
+ * @param props The configuration properties.
+ * @throws HibernateException Indicates a problem configuring this factory.
*/
public void configure(Properties props) throws HibernateException;
/**
- * Get the default connection release mode
+ * Get the default connection release mode.
+ *
+ * @return The default release mode associated with this strategy
*/
public ConnectionReleaseMode getDefaultReleaseMode();
/**
* Do we require access to the JTA TransactionManager for
* this strategy?
+ *
+ * @return True if this strategy requires access to the JTA TransactionManager;
+ * false otherwise.
*/
public boolean isTransactionManagerRequired();
/**
* Are all transaction callbacks local to Hibernate Transactions?
- * Or can the callbacks originate from some other source (e.g.
- * a JTA Synchronization).
+ * Or can the callbacks originate from some other source (e.g. a JTA
+ * Synchronization).
*
- * @return true if callbacks only ever originate from
- * the Hibernate {@link Transaction}; false otherwise.
+ * @return true if callbacks only ever originate from the Hibernate
+ * {@link Transaction}; false otherwise.
*/
public boolean areCallbacksLocalToHibernateTransactions();
@@ -78,9 +114,9 @@
* synchronization as well as whether or not to circumvent
* auto flushing outside transactions.
*
- * @param jdbcContext
- * @param transactionContext
- * @param transaction
+ * @param jdbcContext The JDBC context
+ * @param transactionContext The transaction context
+ * @param transaction The Hibernate transaction
* @return true if an underlying transaction is know to be in effect.
*/
public boolean isTransactionInProgress(JDBCContext jdbcContext, Context transactionContext, Transaction transaction);
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -10,47 +33,55 @@
import org.hibernate.util.ReflectHelper;
/**
+ * Helper for creating {@link TransactionFactory} instances.
+ *
* @author Gavin King
*/
public final class TransactionFactoryFactory {
- private static final Logger log = LoggerFactory.getLogger(TransactionFactoryFactory.class);
+ private static final Logger log = LoggerFactory.getLogger( TransactionFactoryFactory.class );
/**
- * Obtain a TransactionFactory with the transaction handling strategy
- * specified by the given Properties.
+ * Create an appropriate transaction factory based on the given configuration
+ * properties.
*
* @param transactionProps transaction properties
- * @return TransactionFactory
- * @throws HibernateException
+ *
+ * @return The appropriate transaction factory.
+ *
+ * @throws HibernateException Indicates a problem creating the appropriate
+ * transaction factory.
*/
public static TransactionFactory buildTransactionFactory(Properties transactionProps) throws HibernateException {
-
- String strategyClassName = transactionProps.getProperty(Environment.TRANSACTION_STRATEGY);
- if (strategyClassName==null) {
- log.info("Using default transaction strategy (direct JDBC transactions)");
+ String strategyClassName = transactionProps.getProperty( Environment.TRANSACTION_STRATEGY );
+ if ( strategyClassName == null ) {
+ log.info( "Using default transaction strategy (direct JDBC transactions)" );
return new JDBCTransactionFactory();
}
- log.info("Transaction strategy: " + strategyClassName);
+ log.info( "Transaction strategy: " + strategyClassName );
TransactionFactory factory;
try {
- factory = (TransactionFactory) ReflectHelper.classForName(strategyClassName).newInstance();
+ factory = ( TransactionFactory ) ReflectHelper.classForName( strategyClassName ).newInstance();
}
- catch (ClassNotFoundException e) {
- log.error("TransactionFactory class not found", e);
- throw new HibernateException("TransactionFactory class not found: " + strategyClassName);
+ catch ( ClassNotFoundException e ) {
+ log.error( "TransactionFactory class not found", e );
+ throw new HibernateException( "TransactionFactory class not found: " + strategyClassName );
}
- catch (IllegalAccessException e) {
- log.error("Failed to instantiate TransactionFactory", e);
- throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
+ catch ( IllegalAccessException e ) {
+ log.error( "Failed to instantiate TransactionFactory", e );
+ throw new HibernateException( "Failed to instantiate TransactionFactory: " + e );
}
- catch (java.lang.InstantiationException e) {
- log.error("Failed to instantiate TransactionFactory", e);
- throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
+ catch ( java.lang.InstantiationException e ) {
+ log.error( "Failed to instantiate TransactionFactory", e );
+ throw new HibernateException( "Failed to instantiate TransactionFactory: " + e );
}
- factory.configure(transactionProps);
+ factory.configure( transactionProps );
return factory;
}
- private TransactionFactoryFactory() {}
+ /**
+ * Disallow instantiation
+ */
+ private TransactionFactoryFactory() {
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,33 +1,74 @@
-//$Id: TransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
+import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import org.hibernate.HibernateException;
/**
- * Concrete implementations locate and return the JTA
- * <tt>TransactionManager</tt>.
+ * Contract for locating the JTA {@link TransactionManager} on given platform.
+ * <p/>
+ * NOTE: this contract has expanded over time, and basically is a platform
+ * abstraction contract for JTA-related information.
+ *
* @author Gavin King
*/
public interface TransactionManagerLookup {
/**
- * Obtain the JTA <tt>TransactionManager</tt>
+ * Obtain the JTA {@link TransactionManager}.
+ *
+ * @param props The configuration properties.
+ * @return The JTA {@link TransactionManager}.
+ *
+ * @throws HibernateException Indicates problem locating {@link TransactionManager}.
*/
public TransactionManager getTransactionManager(Properties props) throws HibernateException;
/**
- * Return the JNDI name of the JTA <tt>UserTransaction</tt>
- * or <tt>null</tt> (optional operation).
+ * Return the JNDI namespace of the JTA
+ * {@link javax.transaction.UserTransaction} for this platform or <tt>null</tt>;
+ * optional operation.
+ *
+ * @return The JNDI namespace where we can locate the
+ * {@link javax.transaction.UserTransaction} for this platform.
*/
public String getUserTransactionName();
+ /**
+ * Determine an identifier for the given transaction appropriate for use in caching/lookup usages.
+ * <p/>
+ * Generally speaking the transaction itself will be returned here. This method was added specifically
+ * for use in WebSphere and other unfriendly JEE containers (although WebSphere is still the only known
+ * such brain-dead, sales-driven impl).
+ *
+ * @param transaction The transaction to be identified.
+ * @return An appropropriate identifier
+ */
+ public Object getTransactionIdentifier(Transaction transaction);
}
-
-
-
-
-
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: TransactionManagerLookupFactory.java 11412 2007-04-17 14:38:51Z max.andersen(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
@@ -13,38 +35,61 @@
import org.hibernate.util.ReflectHelper;
/**
+ * Helper for generating {@link TransactionManagerLookup} instances.
+ *
* @author Gavin King
*/
public final class TransactionManagerLookupFactory {
private static final Logger log = LoggerFactory.getLogger(TransactionManagerLookupFactory.class);
- private TransactionManagerLookupFactory() {}
+ /**
+ * Disallow instantiation
+ */
+ private TransactionManagerLookupFactory() {
+ }
- public static final TransactionManager getTransactionManager(Properties props) throws HibernateException {
- log.info("obtaining TransactionManager");
- return getTransactionManagerLookup(props).getTransactionManager(props);
+ /**
+ * Convenience method for locating the JTA {@link TransactionManager} from the
+ * given platform config.
+ * <p/>
+ * Same as calling {@link #getTransactionManager}.getTransactionManager( props )
+ *
+ * @param props The properties representing the platform config
+ * @return The located {@link TransactionManager}
+ * @throws HibernateException Indicates a problem either (a) generatng the
+ * {@link TransactionManagerLookup} or (b) asking it to locate the {@link TransactionManager}.
+ */
+ public static TransactionManager getTransactionManager(Properties props) throws HibernateException {
+ log.info( "obtaining TransactionManager" );
+ return getTransactionManagerLookup( props ).getTransactionManager( props );
}
- public static final TransactionManagerLookup getTransactionManagerLookup(Properties props) throws HibernateException {
-
- String tmLookupClass = props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (tmLookupClass==null) {
- log.info("No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)");
+ /**
+ * Generate the appropriate {@link TransactionManagerLookup} given the
+ * config settings being passed.
+ *
+ * @param props The config settings
+ * @return The appropriate {@link TransactionManagerLookup}
+ * @throws HibernateException Indicates problem generating {@link TransactionManagerLookup}
+ */
+ public static TransactionManagerLookup getTransactionManagerLookup(Properties props) throws HibernateException {
+ String tmLookupClass = props.getProperty( Environment.TRANSACTION_MANAGER_STRATEGY );
+ if ( tmLookupClass == null ) {
+ log.info( "No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)" );
return null;
}
else {
-
- log.info("instantiating TransactionManagerLookup: " + tmLookupClass);
-
+ log.info( "instantiating TransactionManagerLookup: " + tmLookupClass );
try {
- TransactionManagerLookup lookup = (TransactionManagerLookup) ReflectHelper.classForName(tmLookupClass).newInstance();
- log.info("instantiated TransactionManagerLookup");
+ TransactionManagerLookup lookup = ( TransactionManagerLookup )
+ ReflectHelper.classForName( tmLookupClass ).newInstance();
+ log.info( "instantiated TransactionManagerLookup" );
return lookup;
}
- catch (Exception e) {
- log.error("Could not instantiate TransactionManagerLookup", e);
- throw new HibernateException("Could not instantiate TransactionManagerLookup '" + tmLookupClass + "'");
+ catch ( Exception e ) {
+ log.error( "Could not instantiate TransactionManagerLookup", e );
+ throw new HibernateException( "Could not instantiate TransactionManagerLookup '" + tmLookupClass + "'" );
}
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: WebSphereExtendedJTATransactionLookup.java 11498 2007-05-09 14:55:16Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.lang.reflect.InvocationHandler;
@@ -40,14 +62,28 @@
*/
public class WebSphereExtendedJTATransactionLookup implements TransactionManagerLookup {
+ /**
+ * {@inheritDoc}
+ */
public TransactionManager getTransactionManager(Properties props) {
return new TransactionManagerAdapter( props );
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
return "java:comp/UserTransaction";
}
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ // WebSphere, however, is not a sane JEE/JTA container...
+ return new Integer( transaction.hashCode() );
+ }
+
public static class TransactionManagerAdapter implements TransactionManager {
private final Properties properties;
private final Class synchronizationCallbackClass;
@@ -75,38 +111,65 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void begin() throws NotSupportedException, SystemException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public void commit() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public int getStatus() throws SystemException {
return getTransaction() == null ? Status.STATUS_NO_TRANSACTION : getTransaction().getStatus();
}
+ /**
+ * {@inheritDoc}
+ */
public Transaction getTransaction() throws SystemException {
return new TransactionAdapter( properties );
}
+ /**
+ * {@inheritDoc}
+ */
public void resume(Transaction txn) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public void rollback() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public void setRollbackOnly() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public void setTransactionTimeout(int i) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public Transaction suspend() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
@@ -125,6 +188,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void registerSynchronization(final Synchronization synchronization)
throws RollbackException, IllegalStateException,
SystemException {
@@ -167,16 +233,27 @@
}
+ /**
+ * {@inheritDoc}
+ */
public int hashCode() {
return getLocalId().hashCode();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean equals(Object other) {
if ( !(other instanceof TransactionAdapter) ) return false;
TransactionAdapter that = (TransactionAdapter) other;
return getLocalId().equals( that.getLocalId() );
}
+ /**
+ * Getter for property 'localId'.
+ *
+ * @return Value for property 'localId'.
+ */
private Object getLocalId() throws HibernateException {
try {
return getLocalIdMethod.invoke( extendedJTATransaction, null );
@@ -186,27 +263,45 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void commit() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean delistResource(XAResource resource, int i) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean enlistResource(XAResource resource) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public int getStatus() {
return new Integer(0).equals( getLocalId() ) ?
Status.STATUS_NO_TRANSACTION : Status.STATUS_ACTIVE;
}
+ /**
+ * {@inheritDoc}
+ */
public void rollback() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public void setRollbackOnly() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java 2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java 2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,9 +1,32 @@
-//$Id: WebSphereTransactionManagerLookup.java 8469 2005-10-26 22:03:03Z oneovthafew $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.transaction;
import java.util.Properties;
import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -11,7 +34,8 @@
import org.hibernate.HibernateException;
/**
- * TransactionManager lookup strategy for WebSphere (versions 4, 5.0 and 5.1)
+ * {@link TransactionManagerLookup} strategy for WebSphere (versions 4, 5.0 and 5.1)
+ *
* @author Gavin King
*/
public class WebSphereTransactionManagerLookup implements TransactionManagerLookup {
@@ -20,49 +44,64 @@
private final int wsVersion;
private final Class tmfClass;
+ /**
+ * Constructs a new WebSphereTransactionManagerLookup.
+ */
public WebSphereTransactionManagerLookup() {
try {
Class clazz;
int version;
try {
- clazz = Class.forName("com.ibm.ws.Transaction.TransactionManagerFactory");
+ clazz = Class.forName( "com.ibm.ws.Transaction.TransactionManagerFactory" );
version = 5;
- log.info("WebSphere 5.1");
+ log.info( "WebSphere 5.1" );
}
- catch (Exception e) {
+ catch ( Exception e ) {
try {
- clazz = Class.forName("com.ibm.ejs.jts.jta.TransactionManagerFactory");
+ clazz = Class.forName( "com.ibm.ejs.jts.jta.TransactionManagerFactory" );
version = 5;
- log.info("WebSphere 5.0");
+ log.info( "WebSphere 5.0" );
}
- catch (Exception e2) {
- clazz = Class.forName("com.ibm.ejs.jts.jta.JTSXA");
+ catch ( Exception e2 ) {
+ clazz = Class.forName( "com.ibm.ejs.jts.jta.JTSXA" );
version = 4;
- log.info("WebSphere 4");
+ log.info( "WebSphere 4" );
}
}
- tmfClass=clazz;
- wsVersion=version;
+ tmfClass = clazz;
+ wsVersion = version;
}
- catch (Exception e) {
+ catch ( Exception e ) {
throw new HibernateException( "Could not obtain WebSphere TransactionManagerFactory instance", e );
}
}
+ /**
+ * {@inheritDoc}
+ */
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
try {
- return (TransactionManager) tmfClass.getMethod("getTransactionManager", null).invoke(null, null);
+ return ( TransactionManager ) tmfClass.getMethod( "getTransactionManager", null ).invoke( null, null );
}
- catch (Exception e) {
+ catch ( Exception e ) {
throw new HibernateException( "Could not obtain WebSphere TransactionManager", e );
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getUserTransactionName() {
- return wsVersion==5 ?
- "java:comp/UserTransaction":
- "jta/usertransaction";
+ return wsVersion == 5
+ ? "java:comp/UserTransaction"
+ : "jta/usertransaction";
}
+ /**
+ * {@inheritDoc}
+ */
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
}
\ No newline at end of file
16 years, 8 months
Hibernate SVN: r14448 - core/trunk/core/src/main/java/org/hibernate/property.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-17 18:17:35 -0400 (Mon, 17 Mar 2008)
New Revision: 14448
Modified:
core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java
Log:
HHH-2268 : handle bridged return types for getters
Modified: core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java 2008-03-17 20:57:09 UTC (rev 14447)
+++ core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java 2008-03-17 22:17:35 UTC (rev 14448)
@@ -316,8 +316,8 @@
Method[] methods = theClass.getDeclaredMethods();
for (int i=0; i<methods.length; i++) {
- // only carry on if the method has no parameters
- if ( methods[i].getParameterTypes().length==0 ) {
+ // only carry on if the method has no parameters and is not a bridge
+ if ( methods[i].getParameterTypes().length == 0 && !methods[i].isBridge() ) {
String methodName = methods[i].getName();
// try "get"
@@ -330,9 +330,7 @@
}
- // if not "get" then try "is"
- /*boolean isBoolean = methods[i].getReturnType().equals(Boolean.class) ||
- methods[i].getReturnType().equals(boolean.class);*/
+ // if not "get", then try "is"
if ( methodName.startsWith("is") ) {
String testStdMethod = Introspector.decapitalize( methodName.substring(2) );
String testOldMethod = methodName.substring(2);
16 years, 8 months
Hibernate SVN: r14447 - maven-poms/trunk/core-manual-parent.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-03-17 16:57:09 -0400 (Mon, 17 Mar 2008)
New Revision: 14447
Modified:
maven-poms/trunk/core-manual-parent/pom.xml
Log:
increment jdocbook plugin to 2.1.0
Modified: maven-poms/trunk/core-manual-parent/pom.xml
===================================================================
--- maven-poms/trunk/core-manual-parent/pom.xml 2008-03-17 20:48:52 UTC (rev 14446)
+++ maven-poms/trunk/core-manual-parent/pom.xml 2008-03-17 20:57:09 UTC (rev 14447)
@@ -52,7 +52,7 @@
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.0.0</version>
+ <version>2.1.0</version>
<extensions>true</extensions>
<dependencies>
<dependency>
16 years, 8 months