01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.orm.jpa;
18:
19: import javax.persistence.EntityManager;
20:
21: /**
22: * Subinterface of {@link javax.persistence.EntityManager} to be implemented by
23: * EntityManager proxies. Allows access to the underlying target EntityManager.
24: *
25: * <p>This interface is mainly intended for framework usage. Application code
26: * should prefer the use of the {@link javax.persistence.EntityManager#getDelegate()}
27: * method to access native functionality of the underlying resource.
28: *
29: * @author Juergen Hoeller
30: * @since 2.5
31: */
32: public interface EntityManagerProxy extends EntityManager {
33:
34: /**
35: * Return the underlying EntityManager that this proxy will delegate to.
36: * <p>In case of an extended EntityManager, this will be the associated
37: * raw EntityManager.
38: * <p>In case of a shared ("transactional") EntityManager, this will be
39: * the raw EntityManager that is currently associated with the transaction.
40: * Outside of a transaction, an IllegalStateException will be thrown.
41: * @return the underlying raw EntityManager (never <code>null</code>)
42: * @throws IllegalStateException if no underlying EntityManager is available
43: */
44: EntityManager getTargetEntityManager() throws IllegalStateException;
45:
46: }
|