|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.orm.jdo.JdoAccessor
Base class for JdoTemplate and JdoInterceptor, defining common properties like 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 explicit notion of flushing never, as this would not imply a performance gain due to JDO's field interception mechanism that doesn't involve snapshot comparison.
Eager flushing is just available for specific JDO implementations. You need to a corresponding JdoDialect to make eager flushing work.
Not intended to be used directly. See JdoTemplate and JdoInterceptor.
JdoTemplate
,
JdoInterceptor
,
setFlushEager(boolean)
Field Summary | |
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
JdoAccessor()
|
Method Summary | |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
DataAccessException |
convertJdoAccessException(javax.jdo.JDOException ex)
Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy. |
void |
flushIfNecessary(javax.jdo.PersistenceManager pm,
boolean existingTransaction)
Flush the given JDO persistence manager if necessary. |
JdoDialect |
getJdoDialect()
Return the JDO dialect to use for this accessor. |
javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
Return the JDO PersistenceManagerFactory that should be used to create PersistenceManagers. |
boolean |
isFlushEager()
Return if this accessor should flush changes to the database eagerly. |
void |
setFlushEager(boolean flushEager)
Set if this accessor should flush changes to the database eagerly. |
void |
setJdoDialect(JdoDialect jdoDialect)
Set the JDO dialect to use for this accessor. |
void |
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
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 |
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public JdoAccessor()
Method Detail |
public void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
public void setJdoDialect(JdoDialect jdoDialect)
The dialect object can be used to retrieve the underlying JDBC connection or to eagerly flush changes to the database.
public JdoDialect getJdoDialect()
public void setFlushEager(boolean flushEager)
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:
public boolean isFlushEager()
public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
public void flushIfNecessary(javax.jdo.PersistenceManager pm, boolean existingTransaction) throws javax.jdo.JDOException
pm
- the current JDO PersistenceManageexistingTransaction
- if executing within an existing transaction
javax.jdo.JDOException
- in case of JDO flushing errorspublic DataAccessException convertJdoAccessException(javax.jdo.JDOException ex)
ex
- JDOException that occured
JdoDialect.translateException(javax.jdo.JDOException)
,
PersistenceManagerFactoryUtils.convertJdoAccessException(javax.jdo.JDOException)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |