Spring Framework

org.springframework.orm.jdo
Class JdoAccessor

java.lang.Object
  extended by org.springframework.orm.jdo.JdoAccessor
All Implemented Interfaces:
InitializingBean
Direct Known Subclasses:
JdoInterceptor, JdoTemplate

Deprecated. as of Spring 3.1, in favor of native PersistenceManager usage (see TransactionAwarePersistenceManagerFactoryProxy and SpringPersistenceManagerProxyBean)

@Deprecated
public abstract class JdoAccessor
extends java.lang.Object
implements InitializingBean

Base class for JdoTemplate and JdoInterceptor, defining common properties such as PersistenceManagerFactory and flushing behavior.

Note: With JDO, modifications to persistent objects are just possible within a transaction (in contrast to Hibernate). Therefore, eager flushing will just get applied when in a transaction. Furthermore, there is no explicit notion of flushing never, as this would not imply a performance gain due to JDO's field interception mechanism (which doesn't involve the overhead of snapshot comparisons).

Eager flushing is just available for specific JDO providers. You need to a corresponding JdoDialect to make eager flushing work.

Not intended to be used directly. See JdoTemplate and JdoInterceptor.

Since:
02.11.2003
Author:
Juergen Hoeller
See Also:
JdoTemplate, JdoInterceptor, setFlushEager(boolean)

Field Summary
protected  org.apache.commons.logging.Log logger
          Deprecated. Logger available to subclasses
 
Constructor Summary
JdoAccessor()
          Deprecated.  
 
Method Summary
 void afterPropertiesSet()
          Deprecated. Eagerly initialize the JDO dialect, creating a default one for the specified PersistenceManagerFactory if none set.
 DataAccessException convertJdoAccessException(javax.jdo.JDOException ex)
          Deprecated. Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy.
protected  void flushIfNecessary(javax.jdo.PersistenceManager pm, boolean existingTransaction)
          Deprecated. Flush the given JDO persistence manager if necessary.
 JdoDialect getJdoDialect()
          Deprecated. Return the JDO dialect to use for this accessor.
 javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
          Deprecated. Return the JDO PersistenceManagerFactory that should be used to create PersistenceManagers.
 boolean isFlushEager()
          Deprecated. Return if this accessor should flush changes to the database eagerly.
 void setFlushEager(boolean flushEager)
          Deprecated. Set if this accessor should flush changes to the database eagerly.
 void setJdoDialect(JdoDialect jdoDialect)
          Deprecated. Set the JDO dialect to use for this accessor.
 void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
          Deprecated. Set the JDO PersistenceManagerFactory that should be used to create PersistenceManagers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Deprecated. 
Logger available to subclasses

Constructor Detail

JdoAccessor

public JdoAccessor()
Deprecated. 
Method Detail

setPersistenceManagerFactory

public void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
Deprecated. 
Set the JDO PersistenceManagerFactory that should be used to create PersistenceManagers.


getPersistenceManagerFactory

public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
Deprecated. 
Return the JDO PersistenceManagerFactory that should be used to create PersistenceManagers.


setJdoDialect

public void setJdoDialect(JdoDialect jdoDialect)
Deprecated. 
Set the JDO dialect to use for this accessor.

The dialect object can be used to retrieve the underlying JDBC connection and to eagerly flush changes to the database.

Default is a DefaultJdoDialect based on the PersistenceManagerFactory's underlying DataSource, if any.


getJdoDialect

public JdoDialect getJdoDialect()
Deprecated. 
Return the JDO dialect to use for this accessor.

Creates a default one for the specified PersistenceManagerFactory if none set.


setFlushEager

public void setFlushEager(boolean flushEager)
Deprecated. 
Set if this accessor should flush changes to the database eagerly.

Eager flushing leads to immediate synchronization with the database, even if in a transaction. This causes inconsistencies to show up and throw a respective exception immediately, and JDBC access code that participates in the same transaction will see the changes as the database is already aware of them then. But the drawbacks are:


isFlushEager

public boolean isFlushEager()
Deprecated. 
Return if this accessor should flush changes to the database eagerly.


afterPropertiesSet

public void afterPropertiesSet()
Deprecated. 
Eagerly initialize the JDO dialect, creating a default one for the specified PersistenceManagerFactory if none set.

Specified by:
afterPropertiesSet in interface InitializingBean

flushIfNecessary

protected void flushIfNecessary(javax.jdo.PersistenceManager pm,
                                boolean existingTransaction)
                         throws javax.jdo.JDOException
Deprecated. 
Flush the given JDO persistence manager if necessary.

Parameters:
pm - the current JDO PersistenceManager
existingTransaction - if executing within an existing transaction (within an existing JDO PersistenceManager that won't be closed immediately)
Throws:
javax.jdo.JDOException - in case of JDO flushing errors

convertJdoAccessException

public DataAccessException convertJdoAccessException(javax.jdo.JDOException ex)
Deprecated. 
Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy.

Default implementation delegates to the JdoDialect. May be overridden in subclasses.

Parameters:
ex - JDOException that occured
Returns:
the corresponding DataAccessException instance
See Also:
JdoDialect.translateException(javax.jdo.JDOException)

Spring Framework