public class AmberPersistenceUnit
extends java.lang.Object
Constructor and Description |
---|
AmberPersistenceUnit(AmberContainer container,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
ListenerType |
addDefaultListener(java.lang.Class beanClass)
Adds a default listener.
|
void |
addEntityClass(java.lang.String className,
java.lang.Class type)
Add an entity.
|
ListenerType |
addEntityListener(java.lang.String entityName,
java.lang.Class listenerClass)
Adds an entity listener.
|
void |
addNamedNativeQuery(java.lang.String name,
NamedNativeQueryConfig queryConfig)
Adds a named native query.
|
void |
addNamedQuery(java.lang.String name,
java.lang.String query)
Adds a named query.
|
void |
addSqlResultSetMapping(java.lang.String resultSetName,
SqlResultSetMappingConfig resultSet)
Adds a sql result set mapping.
|
protected void |
callListeners(int callbackIndex,
Entity entity)
Applies persistence unit default and entity listeners
for @PreXxx, @PostXxx callbacks.
|
void |
complete(java.util.ArrayList<AmberCompletion> completions)
Completions affecting the cache.
|
void |
configure()
Configure lazy.
|
AmberConnection |
createAmberConnection(boolean isExtended)
Returns the cache connection.
|
EmbeddableType |
createEmbeddable(java.lang.Class beanClass)
Adds an embeddable type.
|
EmbeddableType |
createEmbeddable(java.lang.String name,
java.lang.Class beanClass)
Adds an embeddable type.
|
EntityType |
createEntity(java.lang.Class beanClass)
Adds an entity.
|
EntityType |
createEntity(java.lang.String name,
java.lang.Class beanClass)
Adds an entity.
|
EnumType |
createEnum(java.lang.String name,
java.lang.Class beanClass)
Adds an enumerated type.
|
GeneratorTableType |
createGeneratorTable(java.lang.String name)
Adds a generator table.
|
MappedSuperclassType |
createMappedSuperclass(java.lang.String name,
java.lang.Class beanClass)
Adds an entity.
|
SequenceIdGenerator |
createSequenceGenerator(java.lang.String name,
int size)
Returns a sequence generator.
|
AmberTable |
createTable(java.lang.String tableName)
Creates a table.
|
AmberType |
createType(java.lang.Class javaType)
Creates a type.
|
AmberType |
createType(java.lang.String typeName)
Creates a type.
|
void |
destroy()
destroys the manager.
|
void |
generate()
Configure lazy.
|
void |
generate(JavaClassGenerator javaGen)
Configure lazy.
|
AmberContainer |
getAmberContainer() |
CacheConnection |
getCacheConnection()
Returns the cache connection.
|
java.lang.Throwable |
getConfigException() |
java.lang.String |
getCreateColumnSQL(int sqlType,
int length,
int precision,
int scale)
New Version of getCreateTableSQL which returns
the SQL for the table with the given SQL type
but takes sqlType, length, precision, and scale.
|
boolean |
getCreateDatabaseTables()
Set true if database tables should be created automatically.
|
javax.sql.DataSource |
getDataSource()
Gets the data source.
|
ListenerType |
getDefaultListener(java.lang.String className)
Gets a default listener.
|
EmbeddableType |
getEmbeddable(java.lang.String className)
Returns a matching embeddable type.
|
EmbeddableIntrospector |
getEmbeddableIntrospector()
Returns the @Embeddable introspector.
|
java.lang.ClassLoader |
getEnhancedLoader() |
EntityItem |
getEntity(EntityKey entityKey)
Returns the entity with the given key.
|
EntityItem |
getEntity(EntityType rootType,
java.lang.Object key)
Returns the entity with the given key.
|
EntityType |
getEntityByInstanceClass(java.lang.String className)
Returns a matching entity.
|
AmberEntityHome |
getEntityHome(java.lang.String name)
Returns the entity home.
|
EntityItem |
getEntityItem(java.lang.String homeName,
java.lang.Object key)
Returns the entity item.
|
ListenerType |
getEntityListener(java.lang.String className)
Gets an entity listener.
|
EntityManager |
getEntityManager() |
EntityType |
getEntityType(java.lang.Class cl) |
EntityType |
getEntityType(java.lang.String className)
Returns a matching entity.
|
java.lang.String |
getFalseLiteral()
Returns the FALSE SQL literal, i.e., either "false" or "0".
|
AmberGenerator |
getGenerator()
Sets the generator.
|
AmberEntityHome |
getHome(java.lang.Class cl)
Returns an EntityHome.
|
AmberEntityHome |
getHomeBySchema(java.lang.String name)
Returns the entity home by the schema name.
|
MappedSuperclassType |
getMappedSuperclass(java.lang.String className)
Returns a matching mapped superclass.
|
JdbcMetaData |
getMetaData()
Returns the jdbc meta data.
|
java.lang.String |
getName() |
NamedNativeQueryConfig |
getNamedNativeQuery(java.lang.String name)
Returns the named native query.
|
java.lang.String |
getNamedQuery(java.lang.String name)
Returns the named query statement.
|
ResultSetCacheChunk |
getQueryChunk(QueryCacheKey key)
Returns the query result.
|
java.sql.ResultSetMetaData |
getQueryMetaData(QueryCacheKey key)
Returns the query meta data.
|
AbstractQuery |
getQueryParseCache(java.lang.String sql)
Returns the query cache.
|
javax.sql.DataSource |
getReadDataSource()
Gets the read data source.
|
SqlResultSetMappingConfig |
getSqlResultSetMapping(java.lang.String resultSetName)
Returns the sql result set mapping.
|
long |
getTableCacheTimeout()
Get the default table cache time.
|
IdGenerator |
getTableGenerator(java.lang.String name)
Returns a table generator.
|
java.lang.ClassLoader |
getTempClassLoader() |
AmberConnection |
getThreadConnection(boolean isExtended)
Returns the thread's amber connection.
|
boolean |
getValidateDatabaseTables()
Set true if database tables should be validated automatically.
|
javax.sql.DataSource |
getXADataSource()
Gets the xa data source.
|
long |
getXid()
Returns a new xid.
|
boolean |
hasPositionFunction()
Returns true if POSITION SQL function is allowed.
|
boolean |
hasReturnGeneratedKeys()
Returns true if generated keys are allowed.
|
void |
init()
Initialize the resource.
|
void |
initEntityHomes() |
void |
initLoaders()
Initialize the resource.
|
void |
initTables()
Configure lazy.
|
void |
initType(AbstractEnhancedType type)
Configures a type.
|
boolean |
isJPA()
Gets the JPA flag.
|
boolean |
isJta()
Return true for a jta-managed persistence unit
|
java.lang.Class |
loadTempClass(java.lang.String className) |
EntityItem |
putEntity(java.lang.Class cl,
java.lang.Object key,
EntityItem entity)
Sets the entity result.
|
EntityItem |
putEntity(EntityType rootType,
java.lang.Object key,
EntityItem entity)
Sets the entity result.
|
void |
putQueryChunk(QueryCacheKey key,
ResultSetCacheChunk chunk)
Sets the query result.
|
void |
putQueryMetaData(QueryCacheKey key,
java.sql.ResultSetMetaData metaData)
Sets the query meta data.
|
void |
putQueryParseCache(java.lang.String sql,
AbstractQuery query)
Returns the query cache.
|
IdGenerator |
putTableGenerator(java.lang.String name,
IdGenerator gen)
Sets a table generator.
|
EntityItem |
removeEntity(EntityType rootType,
java.lang.Object key)
Remove the entity result.
|
void |
removeThreadConnection()
Unset the thread's amber connection.
|
void |
setBytecodeGenerator(boolean isBytecodeGenerator)
Set false for EJB-style generation.
|
void |
setCreateDatabaseTables(boolean create)
Set true if database tables should be created automatically.
|
void |
setDataSource(javax.sql.DataSource dataSource)
Sets the data source.
|
void |
setEnhancedLoader(java.lang.ClassLoader loader)
EJB/CMP needs to set a special enhanced loader.
|
void |
setEntityMappingsList(java.util.ArrayList<EntityMappingsConfig> entityMappingsList)
Sets the entity mappings config.
|
void |
setJPA(boolean isJPA)
Sets the JPA flag.
|
void |
setJtaDataSource(javax.sql.DataSource dataSource)
Sets the persistence.xml jta data source.
|
void |
setJtaDataSourceName(java.lang.String name)
Sets the persistence.xml jta data source.
|
void |
setName(java.lang.String name) |
void |
setNonJtaDataSource(javax.sql.DataSource dataSource)
Sets the persistence.xml non-jta data source.
|
void |
setNonJtaDataSourceName(java.lang.String name)
Sets the persistence.xml non-jta data source.
|
void |
setReadDataSource(javax.sql.DataSource dataSource)
Sets the read data source.
|
void |
setTableCacheTimeout(long timeout)
Set the default table cache time.
|
void |
setValidateDatabaseTables(boolean validate)
Set true if database tables should be validated automatically.
|
void |
setXADataSource(javax.sql.DataSource dataSource)
Sets the XA data source.
|
java.lang.String |
toString() |
void |
updateCacheItem(EntityType rootType,
java.lang.Object key,
EntityItem cacheItem)
Updates the cache item after commit.
|
void |
updateFlushPriority()
Updates global entity priorities for flushing.
|
public AmberPersistenceUnit(AmberContainer container, java.lang.String name)
public void setName(java.lang.String name)
public java.lang.String getName()
public EntityManager getEntityManager()
public AmberContainer getAmberContainer()
public java.lang.ClassLoader getTempClassLoader()
public java.lang.ClassLoader getEnhancedLoader()
public void setEnhancedLoader(java.lang.ClassLoader loader)
public void setDataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getDataSource()
public void setReadDataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getReadDataSource()
public void setXADataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getXADataSource()
public void setJtaDataSourceName(java.lang.String name)
public void setNonJtaDataSourceName(java.lang.String name)
public void setJtaDataSource(javax.sql.DataSource dataSource)
public void setNonJtaDataSource(javax.sql.DataSource dataSource)
public boolean isJta()
public JdbcMetaData getMetaData()
public void setCreateDatabaseTables(boolean create)
public boolean getCreateDatabaseTables()
public void setValidateDatabaseTables(boolean validate)
public boolean getValidateDatabaseTables()
public void setTableCacheTimeout(long timeout)
public long getTableCacheTimeout()
public void setBytecodeGenerator(boolean isBytecodeGenerator)
public long getXid()
public java.lang.Class loadTempClass(java.lang.String className)
public AmberTable createTable(java.lang.String tableName)
public java.lang.Throwable getConfigException()
public void addEntityClass(java.lang.String className, java.lang.Class type) throws ConfigException
className
- the class nametype
- the JClass type if it is already verified as an
Entity | Embeddable | MappedSuperclassConfigException
public void addSqlResultSetMapping(java.lang.String resultSetName, SqlResultSetMappingConfig resultSet) throws ConfigException
ConfigException
public SqlResultSetMappingConfig getSqlResultSetMapping(java.lang.String resultSetName)
public void addNamedQuery(java.lang.String name, java.lang.String query) throws ConfigException
ConfigException
public java.lang.String getNamedQuery(java.lang.String name)
public void addNamedNativeQuery(java.lang.String name, NamedNativeQueryConfig queryConfig) throws ConfigException
ConfigException
public NamedNativeQueryConfig getNamedNativeQuery(java.lang.String name)
public EntityType createEntity(java.lang.Class beanClass)
public EntityType createEntity(java.lang.String name, java.lang.Class beanClass)
public MappedSuperclassType createMappedSuperclass(java.lang.String name, java.lang.Class beanClass)
public EmbeddableType createEmbeddable(java.lang.Class beanClass)
public EmbeddableType createEmbeddable(java.lang.String name, java.lang.Class beanClass)
public EnumType createEnum(java.lang.String name, java.lang.Class beanClass)
public ListenerType getDefaultListener(java.lang.String className)
public ListenerType addDefaultListener(java.lang.Class beanClass)
public ListenerType getEntityListener(java.lang.String className)
public ListenerType addEntityListener(java.lang.String entityName, java.lang.Class listenerClass)
public IdGenerator getTableGenerator(java.lang.String name)
public IdGenerator putTableGenerator(java.lang.String name, IdGenerator gen)
public GeneratorTableType createGeneratorTable(java.lang.String name)
public SequenceIdGenerator createSequenceGenerator(java.lang.String name, int size) throws ConfigException
ConfigException
public void initType(AbstractEnhancedType type) throws java.lang.Exception
java.lang.Exception
public void generate() throws java.lang.Exception
java.lang.Exception
public boolean isJPA()
public void setJPA(boolean isJPA)
public void generate(JavaClassGenerator javaGen) throws java.lang.Exception
java.lang.Exception
public EmbeddableIntrospector getEmbeddableIntrospector()
public void configure() throws java.lang.Exception
java.lang.Exception
public AmberEntityHome getEntityHome(java.lang.String name)
public AmberEntityHome getHomeBySchema(java.lang.String name)
public EmbeddableType getEmbeddable(java.lang.String className)
public EntityType getEntityType(java.lang.Class cl)
public EntityType getEntityType(java.lang.String className)
public MappedSuperclassType getMappedSuperclass(java.lang.String className)
public EntityType getEntityByInstanceClass(java.lang.String className)
public void updateFlushPriority()
public AmberType createType(java.lang.String typeName) throws ConfigException
ConfigException
public AmberType createType(java.lang.Class javaType) throws ConfigException
ConfigException
public AmberGenerator getGenerator()
public java.lang.String getFalseLiteral()
public boolean hasPositionFunction()
public boolean hasReturnGeneratedKeys()
public void setEntityMappingsList(java.util.ArrayList<EntityMappingsConfig> entityMappingsList)
public void init() throws ConfigException, java.io.IOException
ConfigException
java.io.IOException
public void initLoaders() throws ConfigException, java.io.IOException
ConfigException
java.io.IOException
public void initEntityHomes() throws AmberRuntimeException, ConfigException
AmberRuntimeException
ConfigException
public void initTables() throws ConfigException
ConfigException
public CacheConnection getCacheConnection()
public AmberConnection createAmberConnection(boolean isExtended)
public AmberConnection getThreadConnection(boolean isExtended)
public void removeThreadConnection()
public AmberEntityHome getHome(java.lang.Class cl)
public AbstractQuery getQueryParseCache(java.lang.String sql)
public void putQueryParseCache(java.lang.String sql, AbstractQuery query)
public ResultSetCacheChunk getQueryChunk(QueryCacheKey key)
public java.sql.ResultSetMetaData getQueryMetaData(QueryCacheKey key)
protected void callListeners(int callbackIndex, Entity entity)
public void putQueryChunk(QueryCacheKey key, ResultSetCacheChunk chunk)
public void putQueryMetaData(QueryCacheKey key, java.sql.ResultSetMetaData metaData)
public EntityItem getEntityItem(java.lang.String homeName, java.lang.Object key) throws AmberException
AmberException
public EntityItem getEntity(EntityType rootType, java.lang.Object key)
public EntityItem getEntity(EntityKey entityKey)
public EntityItem putEntity(EntityType rootType, java.lang.Object key, EntityItem entity)
public EntityItem putEntity(java.lang.Class cl, java.lang.Object key, EntityItem entity)
public EntityItem removeEntity(EntityType rootType, java.lang.Object key)
public void updateCacheItem(EntityType rootType, java.lang.Object key, EntityItem cacheItem)
public void complete(java.util.ArrayList<AmberCompletion> completions)
public void destroy()
public java.lang.String getCreateColumnSQL(int sqlType, int length, int precision, int scale)
public java.lang.String toString()
toString
in class java.lang.Object