Skip to content

Commit 7ceb022

Browse files
committed
Removed deprecated JdoTemplate and JdoInterceptor classes; formally requiring JDO 3.0+ now
1 parent cc0ea4a commit 7ceb022

21 files changed

+94
-2695
lines changed

spring-orm/src/main/java/org/springframework/orm/jdo/DefaultJdoDialect.java

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,35 @@
1616

1717
package org.springframework.orm.jdo;
1818

19-
import java.lang.reflect.Method;
2019
import java.sql.Connection;
2120
import java.sql.SQLException;
2221
import javax.jdo.Constants;
2322
import javax.jdo.JDOException;
2423
import javax.jdo.PersistenceManager;
25-
import javax.jdo.Query;
2624
import javax.jdo.Transaction;
2725

28-
import org.apache.commons.logging.Log;
29-
import org.apache.commons.logging.LogFactory;
30-
3126
import org.springframework.dao.DataAccessException;
3227
import org.springframework.dao.support.PersistenceExceptionTranslator;
3328
import org.springframework.jdbc.datasource.ConnectionHandle;
3429
import org.springframework.jdbc.support.JdbcUtils;
3530
import org.springframework.jdbc.support.SQLExceptionTranslator;
3631
import org.springframework.transaction.TransactionDefinition;
3732
import org.springframework.transaction.TransactionException;
38-
import org.springframework.util.ClassUtils;
39-
import org.springframework.util.ReflectionUtils;
4033

4134
/**
4235
* Default implementation of the {@link JdoDialect} interface.
43-
* Requires JDO 2.0; explicitly supports JDO API features up until 3.0.
44-
* Used as default dialect by {@link JdoAccessor} and {@link JdoTransactionManager}.
36+
* As of Spring 4.0, designed for JDO 3.0 (or rather, semantics beyond JDO 3.0).
37+
* Used as default dialect by {@link JdoTransactionManager}.
4538
*
4639
* <p>Simply begins a standard JDO transaction in {@code beginTransaction}.
47-
* Returns a handle for a JDO2 DataStoreConnection on {@code getJdbcConnection}.
48-
* Calls the corresponding JDO2 PersistenceManager operation on {@code flush}
49-
* Translates {@code applyQueryTimeout} to JDO 3.0's {@code setTimeoutMillis}.
40+
* Returns a handle for a JDO DataStoreConnection on {@code getJdbcConnection}.
41+
* Calls the corresponding JDO PersistenceManager operation on {@code flush}
5042
* Uses a Spring SQLExceptionTranslator for exception translation, if applicable.
5143
*
52-
* <p>Note that, even with JDO2, vendor-specific subclasses are still necessary
44+
* <p>Note that, even with JDO 3.0, vendor-specific subclasses are still necessary
5345
* for special transaction semantics and more sophisticated exception translation.
5446
* Furthermore, vendor-specific subclasses are encouraged to expose the native JDBC
55-
* Connection on {@code getJdbcConnection}, rather than JDO2's wrapper handle.
47+
* Connection on {@code getJdbcConnection}, rather than JDO 3.0's wrapper handle.
5648
*
5749
* <p>This class also implements the PersistenceExceptionTranslator interface,
5850
* as autodetected by Spring's PersistenceExceptionTranslationPostProcessor,
@@ -63,18 +55,11 @@
6355
* @author Juergen Hoeller
6456
* @since 1.1
6557
* @see #setJdbcExceptionTranslator
66-
* @see JdoAccessor#setJdoDialect
6758
* @see JdoTransactionManager#setJdoDialect
6859
* @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
6960
*/
7061
public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTranslator {
7162

72-
// JDO 3.0 setTimeoutMillis method available?
73-
private static final Method setTimeoutMillisMethod =
74-
ClassUtils.getMethodIfAvailable(Query.class, "setTimeoutMillis", Integer.class);
75-
76-
protected final Log logger = LogFactory.getLog(getClass());
77-
7863
private SQLExceptionTranslator jdbcExceptionTranslator;
7964

8065

@@ -174,18 +159,14 @@ public void cleanupTransaction(Object transactionData) {
174159
}
175160

176161
/**
177-
* This implementation returns a DataStoreConnectionHandle for JDO2,
178-
* which will also work on JDO1 until actually accessing the JDBC Connection.
179-
* <p>For pre-JDO2 implementations, override this method to return the
180-
* Connection through the corresponding vendor-specific mechanism, or {@code null}
181-
* if the Connection is not retrievable.
182-
* <p><b>NOTE:</b> A JDO2 DataStoreConnection is always a wrapper,
162+
* This implementation returns a DataStoreConnectionHandle for JDO.
163+
* <p><b>NOTE:</b> A JDO DataStoreConnection is always a wrapper,
183164
* never the native JDBC Connection. If you need access to the native JDBC
184165
* Connection (or the connection pool handle, to be unwrapped via a Spring
185166
* NativeJdbcExtractor), override this method to return the native
186167
* Connection through the corresponding vendor-specific mechanism.
187-
* <p>A JDO2 DataStoreConnection is only "borrowed" from the PersistenceManager:
188-
* it needs to be returned as early as possible. Effectively, JDO2 requires the
168+
* <p>A JDO DataStoreConnection is only "borrowed" from the PersistenceManager:
169+
* it needs to be returned as early as possible. Effectively, JDO requires the
189170
* fetched Connection to be closed before continuing PersistenceManager work.
190171
* For this reason, the exposed ConnectionHandle eagerly releases its JDBC
191172
* Connection at the end of each JDBC data access operation (that is, on
@@ -212,25 +193,9 @@ public void releaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager
212193
throws JDOException, SQLException {
213194
}
214195

215-
/**
216-
* This implementation applies a JDO 3.0 query timeout, if available. Otherwise,
217-
* it sets the JPA 2.0 query hints "javax.persistence.lock.timeout" and
218-
* "javax.persistence.query.timeout", assuming that JDO providers are often
219-
* JPA providers as well.
220-
*/
221-
public void applyQueryTimeout(Query query, int remainingTimeInSeconds) throws JDOException {
222-
if (setTimeoutMillisMethod != null) {
223-
ReflectionUtils.invokeMethod(setTimeoutMillisMethod, query, remainingTimeInSeconds);
224-
}
225-
else {
226-
query.addExtension("javax.persistence.lock.timeout", remainingTimeInSeconds);
227-
query.addExtension("javax.persistence.query.timeout", remainingTimeInSeconds);
228-
}
229-
}
230-
231196

232197
//-----------------------------------------------------------------------------------
233-
// Hook for exception translation (used by JdoTransactionManager and JdoTemplate)
198+
// Hook for exception translation (used by JdoTransactionManager)
234199
//-----------------------------------------------------------------------------------
235200

236201
/**
@@ -273,9 +238,9 @@ protected String extractSqlStringFromException(JDOException ex) {
273238

274239

275240
/**
276-
* ConnectionHandle implementation that fetches a new JDO2 DataStoreConnection
241+
* ConnectionHandle implementation that fetches a new JDO DataStoreConnection
277242
* for every {@code getConnection} call and closes the Connection on
278-
* {@code releaseConnection}. This is necessary because JDO2 requires the
243+
* {@code releaseConnection}. This is necessary because JDO requires the
279244
* fetched Connection to be closed before continuing PersistenceManager work.
280245
* @see javax.jdo.PersistenceManager#getDataStoreConnection()
281246
*/

spring-orm/src/main/java/org/springframework/orm/jdo/JdoAccessor.java

Lines changed: 0 additions & 172 deletions
This file was deleted.

spring-orm/src/main/java/org/springframework/orm/jdo/JdoCallback.java

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)