01: /*
02: * Copyright 2002-2006 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: import javax.persistence.EntityManagerFactory;
21: import javax.persistence.spi.PersistenceProvider;
22: import javax.persistence.spi.PersistenceUnitInfo;
23: import javax.sql.DataSource;
24:
25: /**
26: * Metadata interface for a Spring-managed EntityManagerFactory.
27: *
28: * <p>This facility can be obtained from Spring-managed EntityManagerFactory
29: * proxies through casting the EntityManagerFactory to this interface.
30: *
31: * @author Rod Johnson
32: * @author Juergen Hoeller
33: * @since 2.0
34: */
35: public interface EntityManagerFactoryInfo {
36:
37: /**
38: * Return the raw underlying EntityManagerFactory.
39: * @return the unadorned EntityManagerFactory (never <code>null</code>)
40: */
41: EntityManagerFactory getNativeEntityManagerFactory();
42:
43: /**
44: * Return the underlying PersistenceProvider that the underlying
45: * EntityManagerFactory was created with.
46: * @return the PersistenceProvider used to create this EntityManagerFactory,
47: * or <code>null</code> if the standard JPA provider autodetection process
48: * was used to configure the EntityManagerFactory
49: */
50: PersistenceProvider getPersistenceProvider();
51:
52: /**
53: * Return the PersistenceUnitInfo used to create this
54: * EntityManagerFactory, if the in-container API was used.
55: * @return the PersistenceUnitInfo used to create this EntityManagerFactory,
56: * or <code>null</code> if the in-container contract was not used to
57: * configure the EntityManagerFactory
58: */
59: PersistenceUnitInfo getPersistenceUnitInfo();
60:
61: /**
62: * Return the name of the persistence unit used to create this
63: * EntityManagerFactory, or <code>null</code> if
64: * it is an unnamed default. If <code>getPersistenceUnitInfo()</code>
65: * returns non-null, the return type of <code>getPersistenceUnitName()</code>
66: * must be equal to the value returned by
67: * <code>PersistenceUnitInfo.getPersistenceUnitName()</code>.
68: * @see #getPersistenceUnitInfo()
69: * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
70: */
71: String getPersistenceUnitName();
72:
73: /**
74: * Return the JDBC DataSource that this EntityManagerFactory
75: * obtains its JDBC Connections from.
76: * @return the JDBC DataSource, or <code>null</code> if not known
77: */
78: DataSource getDataSource();
79:
80: /**
81: * Return the (potentially vendor-specific) EntityManager interface
82: * that this factory's EntityManagers will implement.
83: */
84: Class<? extends EntityManager> getEntityManagerInterface();
85:
86: /**
87: * Return the vendor-specific JpaDialect implementation for this
88: * EntityManagerFactory, or <code>null</code> if not known.
89: */
90: JpaDialect getJpaDialect();
91:
92: }
|