1 //$Id: SessionFactoryImplementor.java,v 1.28 2005/07/08 14:44:09 epbernard Exp $2 package org.hibernate.engine;3 4 import java.util.Map ;5 import java.util.Set ;6 7 import javax.transaction.TransactionManager ;8 9 import org.hibernate.HibernateException;10 import org.hibernate.MappingException;11 import org.hibernate.SessionFactory;12 import org.hibernate.persister.collection.CollectionPersister;13 import org.hibernate.persister.entity.EntityPersister;14 import org.hibernate.cache.Cache;15 import org.hibernate.cache.QueryCache;16 import org.hibernate.cache.UpdateTimestampsCache;17 import org.hibernate.cfg.Settings;18 import org.hibernate.connection.ConnectionProvider;19 import org.hibernate.dialect.Dialect;20 import org.hibernate.exception.SQLExceptionConverter;21 import org.hibernate.id.IdentifierGenerator;22 import org.hibernate.stat.StatisticsImplementor;23 import org.hibernate.type.Type;24 25 /**26 * Defines the internal contract between the <tt>SessionFactory</tt> and other parts of27 * Hibernate such as implementors of <tt>Type</tt>.28 *29 * @see org.hibernate.SessionFactory30 * @see org.hibernate.impl.SessionFactoryImpl31 * @author Gavin King32 */33 public interface SessionFactoryImplementor extends Mapping, SessionFactory {34 35 /**36 * Get the persister for the named entity37 */38 public EntityPersister getEntityPersister(String entityName) throws MappingException;39 /**40 * Get the persister object for a collection role41 */42 public CollectionPersister getCollectionPersister(String role) throws MappingException;43 44 /**45 * Get the SQL <tt>Dialect</tt>46 */47 public Dialect getDialect();48 49 /**50 * Get the return types of a query51 */52 public Type[] getReturnTypes(String queryString) throws HibernateException;53 54 /**55 * Get the return aliases of a query56 */57 public String [] getReturnAliases(String queryString) throws HibernateException;58 59 /**60 * Get the connection provider61 */62 public ConnectionProvider getConnectionProvider();63 /**64 * Get the names of all persistent classes that implement/extend the given interface/class65 */66 public String [] getImplementors(String className) throws MappingException;67 /**68 * Get a class name, using query language imports69 */70 public String getImportedClassName(String name);71 72 73 /**74 * Get the JTA transaction manager75 */76 public TransactionManager getTransactionManager();77 78 79 /**80 * Get the default query cache81 */82 public QueryCache getQueryCache();83 /**84 * Get a particular named query cache, or the default cache85 * @param regionName the name of the cache region, or null for the default query cache86 * @return the existing cache, or a newly created cache if none by that region name87 */88 public QueryCache getQueryCache(String regionName) throws HibernateException;89 90 /**91 * Get the cache of table update timestamps92 */93 public UpdateTimestampsCache getUpdateTimestampsCache();94 /**95 * Statistics SPI96 */97 public StatisticsImplementor getStatisticsImplementor();98 99 public NamedQueryDefinition getNamedQuery(String queryName);100 public NamedSQLQueryDefinition getNamedSQLQuery(String queryName);101 public ResultSetMappingDefinition getResultSetMapping(String name);102 103 /**104 * Get the identifier generator for the hierarchy105 */106 public IdentifierGenerator getIdentifierGenerator(String rootEntityName);107 108 /**109 * Get a named second-level cache region110 */111 public Cache getSecondLevelCacheRegion(String regionName);112 113 public Map getAllSecondLevelCacheRegions();114 115 /**116 * Retrieves the SQLExceptionConverter in effect for this SessionFactory.117 *118 * @return The SQLExceptionConverter for this SessionFactory.119 */120 public SQLExceptionConverter getSQLExceptionConverter();121 122 public Settings getSettings();123 124 /**125 * Get a nontransactional "current" session for Hibernate EntityManager126 */127 public org.hibernate.classic.Session openTemporarySession() throws HibernateException;128 129 /**130 * Retrieves a set of all the collection roles in which the given entity131 * is a participant, as either an index or an element.132 *133 * @param entityName The entity name for which to get the collection roles.134 * @return set of all the collection roles in which the given entityName participates.135 */136 public Set getCollectionRolesByEntityParticipant(String entityName);137 138 }139