OPENJPA-404

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@586284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-10-19 07:02:22 +00:00
parent e08320284e
commit c4f8a37d91
14 changed files with 725 additions and 7 deletions

View File

@ -21,6 +21,9 @@ package org.apache.openjpa.persistence.jdbc;
import java.util.Collection; import java.util.Collection;
import javax.persistence.LockModeType; import javax.persistence.LockModeType;
import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
import org.apache.openjpa.jdbc.kernel.LRSSizes;
import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
import org.apache.openjpa.persistence.FetchPlan; import org.apache.openjpa.persistence.FetchPlan;
/** /**
@ -142,4 +145,85 @@ public interface JDBCFetchPlan
public JDBCFetchPlan setMaxFetchDepth(int depth); public JDBCFetchPlan setMaxFetchDepth(int depth);
public JDBCFetchPlan setReadLockMode(LockModeType mode); public JDBCFetchPlan setReadLockMode(LockModeType mode);
public JDBCFetchPlan setWriteLockMode(LockModeType mode); public JDBCFetchPlan setWriteLockMode(LockModeType mode);
/**
* @deprecated use the {@link FetchMode} enum instead.
*/
public static final int EAGER_NONE = EagerFetchModes.EAGER_NONE;
/**
* @deprecated use the {@link FetchMode} enum instead.
*/
public static final int EAGER_JOIN = EagerFetchModes.EAGER_JOIN;
/**
* @deprecated use the {@link FetchMode} enum instead.
*/
public static final int EAGER_PARALLEL = EagerFetchModes.EAGER_PARALLEL;
/**
* @deprecated use the {@link LRSSizeAlgorithm} enum instead.
*/
public static final int SIZE_UNKNOWN = LRSSizes.SIZE_UNKNOWN;
/**
* @deprecated use the {@link LRSSizeAlgorithm} enum instead.
*/
public static final int SIZE_LAST = LRSSizes.SIZE_LAST;
/**
* @deprecated use the {@link LRSSizeAlgorithm} enum instead.
*/
public static final int SIZE_QUERY = LRSSizes.SIZE_QUERY;
/**
* @deprecated use the {@link JoinSyntax} enum instead.
*/
public static final int SYNTAX_SQL92 = JoinSyntaxes.SYNTAX_SQL92;
/**
* @deprecated use the {@link JoinSyntax} enum instead.
*/
public static final int SYNTAX_TRADITIONAL =
JoinSyntaxes.SYNTAX_TRADITIONAL;
/**
* @deprecated use the {@link JoinSyntax} enum instead.
*/
public static final int SYNTAX_DATABASE = JoinSyntaxes.SYNTAX_DATABASE;
/**
* @deprecated use {@link #setEagerFetchMode(FetchMode)} instead.
*/
public JDBCFetchPlan setEagerFetchMode(int mode);
/**
* @deprecated use {@link #setSubclassFetchMode(FetchMode)} instead.
*/
public JDBCFetchPlan setSubclassFetchMode(int mode);
/**
* @deprecated use {@link #setResultSetType(ResultSetType)} instead.
*/
public JDBCFetchPlan setResultSetType(int mode);
/**
* @deprecated use {@link #setFetchDirection(FetchDirection)} instead.
*/
public JDBCFetchPlan setFetchDirection(int direction);
/**
* @deprecated use {@link #getLRSSizeAlgorithm()} instead.
*/
public int getLRSSize();
/**
* @deprecated use {@link #setLRSSizeAlgorithm(LRSSizeAlgorithm)} instead.
*/
public JDBCFetchPlan setLRSSize(int lrsSizeMode);
/**
* @deprecated use {@link #setJoinSyntax(JoinSyntax)} instead.
*/
public JDBCFetchPlan setJoinSyntax(int syntax);
} }

View File

@ -65,6 +65,11 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public JDBCFetchPlan setEagerFetchMode(int mode) {
_fetch.setEagerFetchMode(mode);
return this;
}
public FetchMode getSubclassFetchMode() { public FetchMode getSubclassFetchMode() {
return FetchMode.fromKernelConstant(_fetch.getSubclassFetchMode()); return FetchMode.fromKernelConstant(_fetch.getSubclassFetchMode());
} }
@ -74,6 +79,11 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public JDBCFetchPlan setSubclassFetchMode(int mode) {
_fetch.setSubclassFetchMode(mode);
return this;
}
public ResultSetType getResultSetType() { public ResultSetType getResultSetType() {
return ResultSetType.fromKernelConstant(_fetch.getResultSetType()); return ResultSetType.fromKernelConstant(_fetch.getResultSetType());
} }
@ -83,6 +93,11 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public JDBCFetchPlan setResultSetType(int mode) {
_fetch.setResultSetType(mode);
return this;
}
public FetchDirection getFetchDirection() { public FetchDirection getFetchDirection() {
return FetchDirection.fromKernelConstant(_fetch.getFetchDirection()); return FetchDirection.fromKernelConstant(_fetch.getFetchDirection());
} }
@ -92,6 +107,11 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public JDBCFetchPlan setFetchDirection(int direction) {
_fetch.setFetchDirection(direction);
return this;
}
public LRSSizeAlgorithm getLRSSizeAlgorithm() { public LRSSizeAlgorithm getLRSSizeAlgorithm() {
return LRSSizeAlgorithm.fromKernelConstant(_fetch.getLRSSize()); return LRSSizeAlgorithm.fromKernelConstant(_fetch.getLRSSize());
} }
@ -101,6 +121,15 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public int getLRSSize() {
return _fetch.getLRSSize();
}
public JDBCFetchPlan setLRSSize(int lrsSizeMode) {
_fetch.setLRSSize(lrsSizeMode);
return this;
}
public JoinSyntax getJoinSyntax() { public JoinSyntax getJoinSyntax() {
return JoinSyntax.fromKernelConstant(_fetch.getJoinSyntax()); return JoinSyntax.fromKernelConstant(_fetch.getJoinSyntax());
} }
@ -110,6 +139,11 @@ public class JDBCFetchPlanImpl
return this; return this;
} }
public JDBCFetchPlan setJoinSyntax(int syntax) {
_fetch.setJoinSyntax(syntax);
return this;
}
public IsolationLevel getIsolation() { public IsolationLevel getIsolation() {
return IsolationLevel.fromConnectionConstant(_fetch.getIsolation()); return IsolationLevel.fromConnectionConstant(_fetch.getIsolation());
} }

View File

@ -198,6 +198,11 @@ public class EntityManagerImpl
_broker.setRestoreState(val.toKernelConstant()); _broker.setRestoreState(val.toKernelConstant());
} }
public void setRestoreState(int restore) {
assertNotCloseInvoked();
_broker.setRestoreState(restore);
}
public boolean getRetainState() { public boolean getRetainState() {
return _broker.getRetainState(); return _broker.getRetainState();
} }
@ -216,6 +221,11 @@ public class EntityManagerImpl
_broker.setAutoClear(val.toKernelConstant()); _broker.setAutoClear(val.toKernelConstant());
} }
public void setAutoClear(int autoClear) {
assertNotCloseInvoked();
_broker.setAutoClear(autoClear);
}
public DetachStateType getDetachState() { public DetachStateType getDetachState() {
return DetachStateType.fromKernelConstant(_broker.getDetachState()); return DetachStateType.fromKernelConstant(_broker.getDetachState());
} }
@ -225,6 +235,11 @@ public class EntityManagerImpl
_broker.setDetachState(type.toKernelConstant()); _broker.setDetachState(type.toKernelConstant());
} }
public void setDetachState(int detach) {
assertNotCloseInvoked();
_broker.setDetachState(detach);
}
public EnumSet<AutoDetachType> getAutoDetach() { public EnumSet<AutoDetachType> getAutoDetach() {
return AutoDetachType.toEnumSet(_broker.getAutoDetach()); return AutoDetachType.toEnumSet(_broker.getAutoDetach());
} }
@ -239,6 +254,16 @@ public class EntityManagerImpl
_broker.setAutoDetach(AutoDetachType.fromEnumSet(flags)); _broker.setAutoDetach(AutoDetachType.fromEnumSet(flags));
} }
public void setAutoDetach(int autoDetachFlags) {
assertNotCloseInvoked();
_broker.setAutoDetach(autoDetachFlags);
}
public void setAutoDetach(AutoDetachType value, boolean on) {
assertNotCloseInvoked();
_broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(value)),on);
}
public void setAutoDetach(int flag, boolean on) { public void setAutoDetach(int flag, boolean on) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(flag, on); _broker.setAutoDetach(flag, on);
@ -271,6 +296,14 @@ public class EntityManagerImpl
_broker.setTrackChangesByType(trackByType); _broker.setTrackChangesByType(trackByType);
} }
public boolean isLargeTransaction() {
return isTrackChangesByType();
}
public void setLargeTransaction(boolean value) {
setTrackChangesByType(value);
}
public Object getUserObject(Object key) { public Object getUserObject(Object key) {
return _broker.getUserObject(key); return _broker.getUserObject(key);
} }
@ -290,7 +323,7 @@ public class EntityManagerImpl
_broker.removeTransactionListener(listener); _broker.removeTransactionListener(listener);
} }
public EnumSet<CallbackMode> getTransactionListenerCallbackMode() { public EnumSet<CallbackMode> getTransactionListenerCallbackModes() {
return CallbackMode.toEnumSet( return CallbackMode.toEnumSet(
_broker.getTransactionListenerCallbackMode()); _broker.getTransactionListenerCallbackMode());
} }
@ -307,6 +340,14 @@ public class EntityManagerImpl
CallbackMode.fromEnumSet(modes)); CallbackMode.fromEnumSet(modes));
} }
public int getTransactionListenerCallbackMode() {
return _broker.getTransactionListenerCallbackMode();
}
public void setTransactionListenerCallbackMode(int callbackMode) {
throw new UnsupportedOperationException();
}
public void addLifecycleListener(Object listener, Class... classes) { public void addLifecycleListener(Object listener, Class... classes) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.addLifecycleListener(listener, classes); _broker.addLifecycleListener(listener, classes);
@ -317,7 +358,7 @@ public class EntityManagerImpl
_broker.removeLifecycleListener(listener); _broker.removeLifecycleListener(listener);
} }
public EnumSet<CallbackMode> getLifecycleListenerCallbackMode() { public EnumSet<CallbackMode> getLifecycleListenerCallbackModes() {
return CallbackMode.toEnumSet( return CallbackMode.toEnumSet(
_broker.getLifecycleListenerCallbackMode()); _broker.getLifecycleListenerCallbackMode());
} }
@ -334,6 +375,15 @@ public class EntityManagerImpl
CallbackMode.fromEnumSet(modes)); CallbackMode.fromEnumSet(modes));
} }
public int getLifecycleListenerCallbackMode() {
return _broker.getLifecycleListenerCallbackMode();
}
public void setLifecycleListenerCallbackMode(int callbackMode) {
assertNotCloseInvoked();
_broker.setLifecycleListenerCallbackMode(callbackMode);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getReference(Class<T> cls, Object oid) { public <T> T getReference(Class<T> cls, Object oid) {
assertNotCloseInvoked(); assertNotCloseInvoked();

View File

@ -69,4 +69,10 @@ public interface Extent<T>
* Close all open iterators that are consuming database resources. * Close all open iterators that are consuming database resources.
*/ */
public void closeAll(); public void closeAll();
/**
* @deprecated cast to {@link ExtentImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public org.apache.openjpa.kernel.Extent getDelegate();
} }

View File

@ -99,6 +99,16 @@ public interface FetchPlan {
*/ */
public FetchPlan setQueryResultCacheEnabled(boolean cache); public FetchPlan setQueryResultCacheEnabled(boolean cache);
/**
* @deprecated use {@link #getQueryResultCacheEnabled()} instead.
*/
public boolean getQueryResultCache();
/**
* @deprecated use {@link #setQueryResultCacheEnabled} instead.
*/
public FetchPlan setQueryResultCache(boolean cache);
/** /**
* Returns the names of the fetch groups that this component will use * Returns the names of the fetch groups that this component will use
* when loading objects. Defaults to the * when loading objects. Defaults to the
@ -278,4 +288,10 @@ public interface FetchPlan {
* The lock level to use for locking dirtied objects. * The lock level to use for locking dirtied objects.
*/ */
public FetchPlan setWriteLockMode(LockModeType mode); public FetchPlan setWriteLockMode(LockModeType mode);
/**
* @deprecated cast to {@link FetchPlanImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public org.apache.openjpa.kernel.FetchConfiguration getDelegate();
} }

View File

@ -91,6 +91,14 @@ public class FetchPlanImpl
return this; return this;
} }
public boolean getQueryResultCache() {
return getQueryResultCacheEnabled();
}
public FetchPlan setQueryResultCache(boolean cache) {
return setQueryResultCacheEnabled(cache);
}
public Collection<String> getFetchGroups() { public Collection<String> getFetchGroups() {
return _fetch.getFetchGroups(); return _fetch.getFetchGroups();
} }

View File

@ -51,4 +51,10 @@ public interface Generator {
* efficiency. * efficiency.
*/ */
public void allocate(int additional); public void allocate(int additional);
/**
* @deprecated cast to {@link GeneratorImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public org.apache.openjpa.kernel.Seq getDelegate();
} }

View File

@ -21,18 +21,29 @@ package org.apache.openjpa.persistence;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.LockModeType; import javax.persistence.LockModeType;
import javax.persistence.Query; import javax.persistence.Query;
import org.apache.openjpa.event.CallbackModes;
import org.apache.openjpa.kernel.AutoClear;
import org.apache.openjpa.kernel.AutoDetach;
import org.apache.openjpa.kernel.ConnectionRetainModes;
import org.apache.openjpa.kernel.DetachState;
import org.apache.openjpa.kernel.RestoreState;
/** /**
* Interface implemented by OpenJPA entity managers. * Interface implemented by OpenJPA entity managers.
* *
* This interface extends {@link EntityTransaction}, but this extension is
* deprecated.
*
* @since 0.4.0 * @since 0.4.0
* @author Abe White * @author Abe White
* @published * @published
*/ */
public interface OpenJPAEntityManager public interface OpenJPAEntityManager
extends EntityManager { extends EntityManager, EntityTransaction /* deprecated */ {
/** /**
* Return the factory that produced this entity manager. * Return the factory that produced this entity manager.
@ -202,8 +213,10 @@ public interface OpenJPAEntityManager
/** /**
* Bit flags marked in {@link AutoDetachType} which indicate when persistent * Bit flags marked in {@link AutoDetachType} which indicate when persistent
* managed objects should be automatically detached in-place. * managed objects should be automatically detached in-place.
*
* @since 1.1.0
*/ */
public void setAutoDetach(int flag, boolean on); public void setAutoDetach(AutoDetachType value, boolean on);
/** /**
* Whether to also evict an object from the store cache when it is * Whether to also evict an object from the store cache when it is
@ -251,7 +264,7 @@ public interface OpenJPAEntityManager
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public void setTrackChangesByType(boolean largeTransaction); public void setTrackChangesByType(boolean track);
/** /**
* Put the specified key-value pair into the map of user objects. Use * Put the specified key-value pair into the map of user objects. Use
@ -820,4 +833,264 @@ public interface OpenJPAEntityManager
* Returns the current version indicator for <code>o</code>. * Returns the current version indicator for <code>o</code>.
*/ */
public Object getVersion (Object o); public Object getVersion (Object o);
/**
* @deprecated use the {@link ConnectionRetainMode} enum instead.
*/
public static final int CONN_RETAIN_DEMAND =
ConnectionRetainModes.CONN_RETAIN_DEMAND;
/**
* @deprecated use the {@link ConnectionRetainMode} enum instead.
*/
public static final int CONN_RETAIN_TRANS =
ConnectionRetainModes.CONN_RETAIN_TRANS;
/**
* @deprecated use the {@link ConnectionRetainMode} enum instead.
*/
public static final int CONN_RETAIN_ALWAYS =
ConnectionRetainModes.CONN_RETAIN_ALWAYS;
/**
* @deprecated use the {@link DetachStateType} enum instead.
*/
public static final int DETACH_FETCH_GROUPS =
DetachState.DETACH_FETCH_GROUPS;
/**
* @deprecated use the {@link DetachStateType} enum instead.
*/
public static final int DETACH_FGS = DetachState.DETACH_FGS;
/**
* @deprecated use the {@link DetachStateType} enum instead.
*/
public static final int DETACH_LOADED = DetachState.DETACH_LOADED;
/**
* @deprecated use the {@link DetachStateType} enum instead.
*/
public static final int DETACH_ALL = DetachState.DETACH_ALL;
/**
* @deprecated use the {@link RestoreStateType} enum instead.
*/
public static final int RESTORE_NONE = RestoreState.RESTORE_NONE;
/**
* @deprecated use the {@link RestoreStateType} enum instead.
*/
public static final int RESTORE_IMMUTABLE = RestoreState.RESTORE_IMMUTABLE;
/**
* @deprecated use the {@link RestoreStateType} enum instead.
*/
public static final int RESTORE_ALL = RestoreState.RESTORE_ALL;
/**
* @deprecated use the {@link AutoDetachType} enum instead.
*/
public static final int DETACH_CLOSE = AutoDetach.DETACH_CLOSE;
/**
* @deprecated use the {@link AutoDetachType} enum instead.
*/
public static final int DETACH_COMMIT = AutoDetach.DETACH_COMMIT;
/**
* @deprecated use the {@link AutoDetachType} enum instead.
*/
public static final int DETACH_NONTXREAD = AutoDetach.DETACH_NONTXREAD;
/**
* @deprecated use the {@link AutoDetachType} enum instead.
*/
public static final int DETACH_ROLLBACK = AutoDetach.DETACH_ROLLBACK;
/**
* @deprecated use the {@link AutoClearType} enum instead.
*/
public static final int CLEAR_DATASTORE = AutoClear.CLEAR_DATASTORE;
/**
* @deprecated use the {@link AutoClearType} enum instead.
*/
public static final int CLEAR_ALL = AutoClear.CLEAR_ALL;
/**
* @deprecated use the {@link CallbackMode} enum instead.
*/
public static final int CALLBACK_FAIL_FAST =
CallbackModes.CALLBACK_FAIL_FAST;
/**
* @deprecated use the {@link CallbackMode} enum instead.
*/
public static final int CALLBACK_IGNORE = CallbackModes.CALLBACK_IGNORE;
/**
* @deprecated use the {@link CallbackMode} enum instead.
*/
public static final int CALLBACK_LOG = CallbackModes.CALLBACK_LOG;
/**
* @deprecated use the {@link CallbackMode} enum instead.
*/
public static final int CALLBACK_RETHROW = CallbackModes.CALLBACK_RETHROW;
/**
* @deprecated use the {@link CallbackMode} enum instead.
*/
public static final int CALLBACK_ROLLBACK = CallbackModes.CALLBACK_ROLLBACK;
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration();
/**
* @deprecated use {@link #setRestoreState(RestoreStateType)} instead.
*/
public void setRestoreState(int restore);
/**
* @deprecated use {@link #setDetachState(DetachStateType)} instead.
*/
public void setDetachState(int detach);
/**
* @deprecated use {@link #setAutoClear(AutoClearType)} instead.
*/
public void setAutoClear(int autoClear);
/**
* @deprecated use {@link #setAutoDetach(AutoDetachType)} or
* {@link #setAutoDetach(java.util.EnumSet)} instead.
*/
public void setAutoDetach(int autoDetachFlags);
/**
* @deprecated use {@link #setAutoDetach(AutoDetachType, boolean)} instead.
*/
public void setAutoDetach(int flag, boolean on);
/**
* @deprecated use {@link #isTrackChangesByType()} instead.
*/
public boolean isLargeTransaction();
/**
* @deprecated use {@link #setTrackChangesByType(boolean)} instead.
*/
public void setLargeTransaction(boolean value);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void addTransactionListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void removeTransactionListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public int getTransactionListenerCallbackMode();
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void setTransactionListenerCallbackMode(int callbackMode);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void addLifecycleListener(Object listener, Class... classes);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void removeLifecycleListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public int getLifecycleListenerCallbackMode();
/**
* @deprecated cast to {@link OpenJPAEntityManagerSPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void setLifecycleListenerCallbackMode(int callbackMode);
/**
* @deprecated use {@link EntityTransaction#begin}
* instead: <code>em.getTransaction().begin()</code>
*/
public void begin();
/**
* @deprecated use {@link EntityTransaction#commit}
* instead: <code>em.getTransaction().commit()</code>
*/
public void commit();
/**
* @deprecated use {@link EntityTransaction#rollback}
* instead: <code>em.getTransaction().rollback()</code>
*/
public void rollback();
/**
* @deprecated use {@link EntityTransaction#isActive}
* instead: <code>em.getTransaction().isActive()</code>
*/
public boolean isActive();
/**
* @deprecated use {@link OpenJPAEntityTransaction#commitAndResume} instead:
* <code>em.getTransaction().commitAndResume()</code>
*/
public void commitAndResume();
/**
* @deprecated use {@link OpenJPAEntityTransaction#rollbackAndResume}
* instead: <code>em.getTransaction().rollbackAndResume()</code>
*/
public void rollbackAndResume();
/**
* @deprecated use {@link EntityTransaction#setRollbackOnly}
* instead: <code>em.getTransaction().setRollbackOnly()</code>
*/
public void setRollbackOnly();
/**
* @deprecated use {@link OpenJPAEntityTransaction#setRollbackOnly}
* instead: <code>em.getTransaction().setRollbackOnly()</code>
*/
public void setRollbackOnly(Throwable cause);
/**
* @deprecated use {@link OpenJPAEntityTransaction#getRollbackCause}
* instead: <code>em.getTransaction().getRollbackCause()</code>
*/
public Throwable getRollbackCause();
/**
* @deprecated use {@link EntityTransaction#getRollbackOnly}
* instead: <code>em.getTransaction().getRollbackOnly()</code>
*/
public boolean getRollbackOnly();
} }

View File

@ -78,4 +78,49 @@ public interface OpenJPAEntityManagerFactory
* </ul> * </ul>
*/ */
public OpenJPAEntityManager createEntityManager(Map props); public OpenJPAEntityManager createEntityManager(Map props);
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
public static final int CONN_RETAIN_DEMAND = 0;
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
public static final int CONN_RETAIN_TRANS = 1;
/**
* @deprecated use {@link ConnectionRetainMode} enums instead.
*/
public static final int CONN_RETAIN_ALWAYS = 2;
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration();
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void addLifecycleListener(Object listener, Class... classes);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void removeLifecycleListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void addTransactionListener(Object listener);
/**
* @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public void removeTransactionListener(Object listener);
} }

View File

@ -53,8 +53,10 @@ public interface OpenJPAEntityManagerSPI
/** /**
* The {@link CallbackMode} flags for handling transaction listener * The {@link CallbackMode} flags for handling transaction listener
* exceptions. * exceptions.
*
* @since 1.1.0
*/ */
public EnumSet<CallbackMode> getTransactionListenerCallbackMode(); public EnumSet<CallbackMode> getTransactionListenerCallbackModes();
/** /**
* The {@link CallbackMode} flag for handling transaction listener * The {@link CallbackMode} flag for handling transaction listener
@ -85,8 +87,10 @@ public interface OpenJPAEntityManagerSPI
/** /**
* The {@link CallbackMode} flags for handling lifecycle listener * The {@link CallbackMode} flags for handling lifecycle listener
* exceptions. * exceptions.
*
* @since 1.1.0
*/ */
public EnumSet<CallbackMode> getLifecycleListenerCallbackMode(); public EnumSet<CallbackMode> getLifecycleListenerCallbackModes();
/** /**
* The {@link CallbackMode} flag for handling lifecycle listener * The {@link CallbackMode} flag for handling lifecycle listener

View File

@ -18,6 +18,7 @@
*/ */
package org.apache.openjpa.persistence; package org.apache.openjpa.persistence;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.InitialContext; import javax.naming.InitialContext;
@ -197,4 +198,122 @@ public class OpenJPAPersistence {
throw PersistenceExceptions.toPersistenceException(e); throw PersistenceExceptions.toPersistenceException(e);
} }
} }
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static final String EM_KEY =
"org.apache.openjpa.persistence.EntityManager";
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static final String EMF_KEY =
"org.apache.openjpa.persistence.EntityManagerFactory";
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static OpenJPAEntityManagerFactory toEntityManagerFactory(
org.apache.openjpa.kernel.BrokerFactory factory) {
return JPAFacadeHelper.toEntityManagerFactory(factory);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static org.apache.openjpa.kernel.BrokerFactory toBrokerFactory(
EntityManagerFactory factory) {
return JPAFacadeHelper.toBrokerFactory(factory);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static OpenJPAEntityManager toEntityManager(
org.apache.openjpa.kernel.Broker broker) {
return JPAFacadeHelper.toEntityManager(broker);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Broker toBroker(EntityManager em) {
return JPAFacadeHelper.toBroker(em);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static org.apache.openjpa.meta.ClassMetaData getMetaData(Object o) {
return JPAFacadeHelper.getMetaData(o);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static org.apache.openjpa.meta.ClassMetaData getMetaData(
EntityManager em, Class cls) {
return JPAFacadeHelper.getMetaData(em, cls);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static org.apache.openjpa.meta.ClassMetaData getMetaData(
EntityManagerFactory factory, Class cls) {
return JPAFacadeHelper.getMetaData(factory, cls);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Object fromOpenJPAObjectId(Object oid) {
return JPAFacadeHelper.fromOpenJPAObjectId(oid);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Object toOpenJPAObjectId(
org.apache.openjpa.meta.ClassMetaData meta, Object oid) {
return JPAFacadeHelper.toOpenJPAObjectId(meta, oid);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Object[] toOpenJPAObjectIds(
org.apache.openjpa.meta.ClassMetaData meta, Object... oids) {
return JPAFacadeHelper.toOpenJPAObjectIds(meta, oids);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Collection toOpenJPAObjectIds(
org.apache.openjpa.meta.ClassMetaData meta, Collection oids) {
return JPAFacadeHelper.toOpenJPAObjectIds(meta, oids);
}
/**
* @deprecated use {@link JPAFacadeHelper} instead. This method pierces
* the published-API boundary, as does the JPAFacadeHelper utilization.
*/
public static Class fromOpenJPAObjectIdClass(Class oidClass) {
return JPAFacadeHelper.fromOpenJPAObjectIdClass(oidClass);
}
} }

View File

@ -26,7 +26,9 @@ import javax.persistence.FlushModeType;
import javax.persistence.Query; import javax.persistence.Query;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.apache.openjpa.kernel.QueryFlushModes;
import org.apache.openjpa.kernel.QueryHints; import org.apache.openjpa.kernel.QueryHints;
import org.apache.openjpa.kernel.QueryOperations;
/** /**
* Interface implemented by OpenJPA queries. * Interface implemented by OpenJPA queries.
@ -194,4 +196,63 @@ public interface OpenJPAQuery
* Return the current flush mode. * Return the current flush mode.
*/ */
public FlushModeType getFlushMode (); public FlushModeType getFlushMode ();
/**
* @deprecated use the {@link QueryOperationType} instead.
*/
public static final int OP_SELECT = QueryOperations.OP_SELECT;
/**
* @deprecated use the {@link QueryOperationType} instead.
*/
public static final int OP_DELETE = QueryOperations.OP_DELETE;
/**
* @deprecated use the {@link QueryOperationType} instead.
*/
public static final int OP_UPDATE = QueryOperations.OP_DELETE;
/**
* @deprecated use the {@link FlushModeType} enum instead.
*/
public static final int FLUSH_TRUE = QueryFlushModes.FLUSH_TRUE;
/**
* @deprecated use the {@link FlushModeType} enum instead.
*/
public static final int FLUSH_FALSE = QueryFlushModes.FLUSH_FALSE;
/**
* @deprecated use the {@link FlushModeType} enum instead.
*/
public static final int FLUSH_WITH_CONNECTION =
QueryFlushModes.FLUSH_WITH_CONNECTION;
/**
* @deprecated cast to {@link QueryImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public OpenJPAQuery addFilterListener(
org.apache.openjpa.kernel.exps.FilterListener listener);
/**
* @deprecated cast to {@link QueryImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public OpenJPAQuery removeFilterListener(
org.apache.openjpa.kernel.exps.FilterListener listener);
/**
* @deprecated cast to {@link QueryImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public OpenJPAQuery addAggregateListener(
org.apache.openjpa.kernel.exps.AggregateListener listener);
/**
* @deprecated cast to {@link QueryImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public OpenJPAQuery removeAggregateListener(
org.apache.openjpa.kernel.exps.AggregateListener listener);
} }

View File

@ -55,4 +55,10 @@ public interface QueryResultCache {
* Evict all result for queries involving the given class. * Evict all result for queries involving the given class.
*/ */
public void evictAll(Class cls); public void evictAll(Class cls);
/**
* @deprecated cast to {@link QueryResultCacheImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public QueryCache getDelegate();
} }

View File

@ -96,4 +96,10 @@ public interface StoreCache {
* Clear the cache. * Clear the cache.
*/ */
public void evictAll(); public void evictAll();
/**
* @deprecated cast to {@link StoreCacheImpl} instead. This
* method pierces the published-API boundary, as does the SPI cast.
*/
public DataCache getDelegate();
} }