| java.lang.Object org.springframework.orm.jdo.JdoAccessor
All known Subclasses: org.springframework.orm.jdo.JdoTemplate, org.springframework.orm.jdo.JdoInterceptor,
JdoAccessor | abstract public class JdoAccessor implements InitializingBean(Code) | | 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.
author: Juergen Hoeller since: 02.11.2003 See Also: JdoTemplate See Also: JdoInterceptor See Also: JdoAccessor.setFlushEager |
Field Summary | |
final protected Log | logger |
Method Summary | |
public void | afterPropertiesSet() Eagerly initialize the JDO dialect, creating a default one
for the specified PersistenceManagerFactory if none set. | public DataAccessException | convertJdoAccessException(JDOException ex) Convert the given JDOException to an appropriate exception from the
org.springframework.dao hierarchy. | protected void | flushIfNecessary(PersistenceManager pm, boolean existingTransaction) Flush the given JDO persistence manager if necessary. | public JdoDialect | getJdoDialect() Return the JDO dialect to use for this accessor. | public PersistenceManagerFactory | getPersistenceManagerFactory() Return the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers. | public boolean | isFlushEager() Return if this accessor should flush changes to the database eagerly. | public void | setFlushEager(boolean flushEager) 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. | public void | setJdoDialect(JdoDialect jdoDialect) Set the JDO dialect to use for this accessor. | public void | setPersistenceManagerFactory(PersistenceManagerFactory pmf) Set the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers. |
logger | final protected Log logger(Code) | | Logger available to subclasses
|
afterPropertiesSet | public void afterPropertiesSet()(Code) | | Eagerly initialize the JDO dialect, creating a default one
for the specified PersistenceManagerFactory if none set.
|
convertJdoAccessException | public DataAccessException convertJdoAccessException(JDOException ex)(Code) | | 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 the corresponding DataAccessException instance See Also: JdoDialect.translateException |
flushIfNecessary | protected void flushIfNecessary(PersistenceManager pm, boolean existingTransaction) throws JDOException(Code) | | Flush the given JDO persistence manager if necessary.
Parameters: pm - the current JDO PersistenceManager Parameters: existingTransaction - if executing within an existing transaction(within an existing JDO PersistenceManager that won't be closed immediately) throws: JDOException - in case of JDO flushing errors |
getJdoDialect | public JdoDialect getJdoDialect()(Code) | | Return the JDO dialect to use for this accessor.
Creates a default one for the specified PersistenceManagerFactory if none set.
|
getPersistenceManagerFactory | public PersistenceManagerFactory getPersistenceManagerFactory()(Code) | | Return the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers.
|
isFlushEager | public boolean isFlushEager()(Code) | | Return if this accessor should flush changes to the database eagerly.
|
setFlushEager | public void setFlushEager(boolean flushEager)(Code) | | 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:
- additional communication roundtrips with the database, instead of a
single batch at transaction commit;
- the fact that an actual database rollback is needed if the JDO
transaction rolls back (due to already submitted SQL statements).
|
setJdoDialect | public void setJdoDialect(JdoDialect jdoDialect)(Code) | | 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.
|
setPersistenceManagerFactory | public void setPersistenceManagerFactory(PersistenceManagerFactory pmf)(Code) | | Set the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers.
|
|
|