| java.lang.Object org.springframework.orm.jpa.EntityManagerFactoryAccessor org.springframework.orm.jpa.JpaAccessor
All known Subclasses: org.springframework.orm.jpa.JpaInterceptor, org.springframework.orm.jpa.JpaTemplate,
Method Summary | |
public void | afterPropertiesSet() Eagerly initialize the JPA dialect, creating a default one
for the specified EntityManagerFactory if none set. | protected void | flushIfNecessary(EntityManager em, boolean existingTransaction) Flush the given JPA entity manager if necessary. | public EntityManager | getEntityManager() Return the JPA EntityManager to use. | public JpaDialect | getJpaDialect() Return the JPA dialect to use for this accessor. | public boolean | isFlushEager() Return if this accessor should flush changes to the database eagerly. | public void | setEntityManager(EntityManager entityManager) Set the JPA EntityManager to use. | 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 | setJpaDialect(JpaDialect jpaDialect) Set the JPA dialect to use for this accessor. | public RuntimeException | translateIfNecessary(RuntimeException ex) Convert the given runtime exception to an appropriate exception from the
org.springframework.dao hierarchy if necessary, or
return the exception itself if it is not persistence related
Default implementation delegates to the JpaDialect. |
afterPropertiesSet | public void afterPropertiesSet()(Code) | | Eagerly initialize the JPA dialect, creating a default one
for the specified EntityManagerFactory if none set.
|
flushIfNecessary | protected void flushIfNecessary(EntityManager em, boolean existingTransaction) throws PersistenceException(Code) | | Flush the given JPA entity manager if necessary.
Parameters: em - the current JPA PersistenceManage Parameters: existingTransaction - if executing within an existing transaction throws: javax.persistence.PersistenceException - in case of JPA flushing errors |
getEntityManager | public EntityManager getEntityManager()(Code) | | Return the JPA EntityManager to use.
|
getJpaDialect | public JpaDialect getJpaDialect()(Code) | | Return the JPA dialect to use for this accessor.
Creates a default one for the specified EntityManagerFactory if none set.
|
isFlushEager | public boolean isFlushEager()(Code) | | Return if this accessor should flush changes to the database eagerly.
|
setEntityManager | public void setEntityManager(EntityManager entityManager)(Code) | | Set the JPA EntityManager to use.
|
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 JPA
transaction rolls back (due to already submitted SQL statements).
|
setJpaDialect | public void setJpaDialect(JpaDialect jpaDialect)(Code) | | Set the JPA dialect to use for this accessor.
The dialect object can be used to retrieve the underlying JDBC
connection, for example.
|
translateIfNecessary | public RuntimeException translateIfNecessary(RuntimeException ex)(Code) | | Convert the given runtime exception to an appropriate exception from the
org.springframework.dao hierarchy if necessary, or
return the exception itself if it is not persistence related
Default implementation delegates to the JpaDialect.
May be overridden in subclasses.
Parameters: ex - runtime exception that occured, which may or may notbe JPA-related the corresponding DataAccessException instance ifwrapping should occur, otherwise the raw exception See Also: org.springframework.dao.support.DataAccessUtils.translateIfNecessary |
Fields inherited from org.springframework.orm.jpa.EntityManagerFactoryAccessor | final protected Log logger(Code)(Java Doc)
|
|
|