本文整理汇总了Java中org.eclipse.persistence.internal.sessions.AbstractSession类的典型用法代码示例。如果您正苦于以下问题:Java AbstractSession类的具体用法?Java AbstractSession怎么用?Java AbstractSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractSession类属于org.eclipse.persistence.internal.sessions包,在下文中一共展示了AbstractSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeDefaultQueries
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
/**
* THIS IS CALLED FIRST
* Allow the platform to initialize the CRUD queries to defaults.
* Configure the CRUD operations using GET/PUT and DELETE.
*/
@Override
public void initializeDefaultQueries(DescriptorQueryManager qm, AbstractSession session) {
if (!qm.hasInsertQuery()) {
qm.setInsertCall(getCall(qm, DemoOperation.INSERT));
}
if (!qm.hasUpdateQuery()) {
qm.setUpdateCall(getCall(qm, DemoOperation.UPDATE));
}
if (!qm.hasReadObjectQuery()) {
qm.setReadObjectCall(getCall(qm, DemoOperation.FIND));
}
if (!qm.hasDeleteQuery()) {
qm.setDeleteCall(getCall(qm, DemoOperation.REMOVE));
}
}
示例2: buildCallFromStatement
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
public DatasourceCall buildCallFromStatement(SQLStatement statement, DatabaseQuery query, AbstractSession session) {
//System.out.println("buildCallFromStatement");
if (!query.isObjectLevelReadQuery()) {
throw new EISException("Query too complex, only select queries are supported: " + query);
}
MappedInteraction interaction = new MappedInteraction();
// Experimantal
interaction.setProperty("SQLStatement", statement);
interaction.setProperty(OPERATION, DemoOperation.FIND);
interaction.setProperty(TABLE, ((EISDescriptor) query.getDescriptor()).getDataTypeName());
interaction.setProperty(KEYS, getPrimaryKeys(query.getDescriptor()));
//interaction.setInputRow(row);
return interaction;
}
示例3: buildDBTable
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
/**
* INTERNAL: Return the create table object.
*/
public void buildDBTable(AbstractSession session, DBMapping dbMapping) throws ValidationException {
DBTable dBTable;
Entity entity = (Entity) intrinsicEntity.get(0);
Table table;
if (attribute instanceof RelationAttribute) {
dBTable = new DBRelationTable(getFullName(), entity, (RelationAttribute) attribute);//Todo pass managedClass
} else if (attribute instanceof ElementCollection) {
dBTable = new DBCollectionTable(getFullName(), entity, (ElementCollection) attribute);
} else if((table = entity.getTable(getFullName())) instanceof SecondaryTable){
dBTable = new DBSecondaryTable(getFullName(), entity, (SecondaryTable)table);
} else {
dBTable = new DBBaseTable(getFullName(), entity);
}
dBTable.setId(NBModelerUtil.getAutoGeneratedStringId());
for (Iterator<FieldDefinition> itetrator = getFields().iterator(); itetrator.hasNext();) {
JPAMFieldDefinition field = (JPAMFieldDefinition) itetrator.next();
field.buildDBColumn(dBTable, session, this);
}
dbMapping.addTable(dBTable);
}
示例4: profileExecutionOfQuery
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
public Object profileExecutionOfQuery( DatabaseQuery query, Record row, AbstractSession session )
{
if( this.profileWeight < SessionProfiler.HEAVY )
{
return session.internalExecuteQuery( query, (AbstractRecord) row );
}
startOperationProfile( query.getMonitorName() );
startOperationProfile( query.getClass().getSimpleName() );
occurred( query.getClass().getSimpleName(), session );
occurred( query.getMonitorName(), session );
try
{
return session.internalExecuteQuery( query, (AbstractRecord) row );
}
finally
{
endOperationProfile( query.getMonitorName() );
endOperationProfile( query.getClass().getSimpleName() );
}
}
示例5: select
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
/**
* INTERNAL:
*/
protected Object select(Accessor accessor, AbstractSession writeSession, String seqName, Integer size) {
ValueReadQuery query = getSelectQuery();
if (query != null) {
if (accessor != null) {
// PERF: Prepare the query before being cloned.
// Also BUG: SQLCall could not be prepared concurrently by different queries.
// Setting user define allow custom SQL query to be prepared without translation row.
query.setIsUserDefined(true);
query.checkPrepare(writeSession, null);
query = (ValueReadQuery)query.clone();
query.setAccessor(accessor);
}
} else {
query = buildSelectQuery(seqName, size);
if (accessor != null) {
query.setAccessor(accessor);
}
}
Vector args = createArguments(query, seqName, size);
if (args != null) {
return writeSession.executeQuery(query, args);
} else {
return writeSession.executeQuery(query);
}
}
示例6: test
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
protected Object test(Accessor accessor, AbstractSession writeSession, String seqName, Integer size) {
ValueReadQuery query = getTestQuery();
if (query != null) {
if (accessor != null) {
// PERF: Prepare the query before being cloned.
// Also BUG: SQLCall could not be prepared concurrently by different queries.
// Setting user define allow custom SQL query to be prepared without translation row.
query.setIsUserDefined(true);
query.checkPrepare(writeSession, null);
query = (ValueReadQuery)query.clone();
query.setAccessor(accessor);
}
} else {
query = buildTestQuery(seqName);
if (accessor != null) {
query.setAccessor(accessor);
}
}
Vector args = createArguments(query, seqName, size);
if (args != null) {
return writeSession.executeQuery(query, args);
} else {
return writeSession.executeQuery(query);
}
}
示例7: processDataResults
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
protected void processDataResults(AbstractSession session) {
int originalMax = baseQuery.getMaxRows();
int originalFirst = baseQuery.getFirstResult();
try {
baseQuery.setMaxRows(0);
baseQuery.setFirstResult(0);
super.processDataResults(session);
} finally {
baseQuery.setMaxRows(originalMax);
baseQuery.setFirstResult(originalFirst);
}
}
示例8: registerInstance
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
public void registerInstance(Entity entity, AbstractSession session) {
// Can be called outside of a transaction when fetching lazy attributes
if (!TransactionSynchronizationManager.isActualTransactionActive())
return;
if (!(session instanceof UnitOfWork))
throw new RuntimeException("Session is not a UnitOfWork: " + session);
getInstanceContainerResourceHolder(getStorageName(session)).registerInstanceForUnitOfWork(entity, (UnitOfWork) session);
}
示例9: getGeneratedValue
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object getGeneratedValue(Accessor accessor, AbstractSession writeSession, String seqName) {
DataSource dataSource = ((JNDIConnector) writeSession.getLogin().getConnector()).getDataSource();
DataFieldMaxValueIncrementer incrementer = MaxValueIncrementerFactory.getIncrementer(dataSource,
sequenceName);
return Long.valueOf(incrementer.nextLongValue());
}
示例10: buildFieldTypes
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
/**
* INTERNAL: Build the foreign key constraints.
*/
@Override
protected void buildFieldTypes(AbstractSession session) {
// The ForeignKeyConstraint object is the newer way of doing things.
// We support FieldDefinition.getForeignKeyFieldName() due to backwards compatibility
// by converting it. To allow mixing both ways, we just add converted one to foreignKeys list.
for (FieldDefinition field : getFields()) {
if (field.getForeignKeyFieldName() != null) {
addForeignKeyConstraint(buildForeignKeyConstraint(field, session.getPlatform()));
}
}
}
示例11: createUniqueConstraintsOnDatabase
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
void createUniqueConstraintsOnDatabase(final AbstractSession session) throws ValidationException, DatabaseException {
if ((!session.getPlatform().supportsUniqueKeyConstraints())
|| getUniqueKeys().isEmpty()
|| session.getPlatform().requiresUniqueConstraintCreationOnTableCreate()) {
return;
}
for (UniqueKeyConstraint uniqueKey : getUniqueKeys()) {
session.priviledgedExecuteNonSelectingCall(new org.eclipse.persistence.queries.SQLCall(buildUniqueConstraintCreationWriter(session, uniqueKey, new StringWriter()).toString()));
}
}
示例12: createForeignConstraintsOnDatabase
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
void createForeignConstraintsOnDatabase(final AbstractSession session) throws ValidationException, DatabaseException {
if ((!session.getPlatform().supportsForeignKeyConstraints()) || getForeignKeyMap().isEmpty()) {
return;
}
for (ForeignKeyConstraint foreignKey : getForeignKeyMap().values()) {
if (!foreignKey.disableForeignKey()) {
session.priviledgedExecuteNonSelectingCall(new SQLCall(buildConstraintCreationWriter(session, foreignKey, new StringWriter()).toString()));
}
}
}
示例13: JPAMMetadataProcessor
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
public JPAMMetadataProcessor(AbstractSession session, ClassLoader loader, boolean weaveLazy, boolean weaveEager, boolean weaveFetchGroups, boolean multitenantSharedEmf, boolean multitenantSharedCache, Map predeployProperties, MetadataProcessor compositeProcessor) {
m_loader = loader;
m_session = session;
m_project = new JPAMMetadataProject(session, weaveLazy, weaveEager, weaveFetchGroups, multitenantSharedEmf, multitenantSharedCache);
m_predeployProperties = predeployProperties;
m_compositeProcessor = compositeProcessor;
if (m_compositeProcessor != null) {
m_compositeProcessor.addCompositeMemberProcessor(this);
m_project.setCompositeProcessor(m_compositeProcessor);
}
}
示例14: getJdbcConnection
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
public ConnectionHandle getJdbcConnection(EntityManager em, boolean readOnly)
throws PersistenceException, SQLException {
AbstractSession session = (AbstractSession) getSession(em);
// The connection was already acquired eagerly in beginTransaction,
// unless lazyDatabaseTransaction was set to true.
Connection con = session.getAccessor().getConnection();
return (con != null ? new SimpleConnectionHandle(con) : null);
}
示例15: occurred
import org.eclipse.persistence.internal.sessions.AbstractSession; //导入依赖的package包/类
@Override
public void occurred( String operationName, DatabaseQuery query, AbstractSession session )
{
if( this.profileWeight < SessionProfiler.NORMAL )
{
return;
}
occurred( operationName, session );
occurred( query.getMonitorName() + ":" + operationName, session );
}