SessionImplementor getPersistenceContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SessionImplementor getPersistenceContext method.

This code example shows how to use the following methods:getPersistenceContext
	/** 
	 * {@inheritDoc} 
	 */ 
	public void lock( 
			Serializable id,
			Object version, 
			Object object, 
			int timeout,
			SessionImplementor session) throws StaleObjectStateException, JDBCException {
		if ( !lockable.isVersioned() ) {
			throw new HibernateException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
		} 
		EntityEntry entry = session.getPersistenceContext().getEntry( object );
		final EntityPersister persister = entry.getPersister();
		Object nextVersion = persister.forceVersionIncrement( entry.getId(), entry.getVersion(), session );
		entry.forceLocked( object, nextVersion );
	} 
 
	/** 
	 * Retrieve the specific lock mode defined. 
8
CodeRank
This code example shows how to use the following methods:getPersistenceContext
	public SessionStatisticsImpl(SessionImplementor session) {
		this.session = session;
	} 
 
	public int getEntityCount() { 
		return session.getPersistenceContext().getEntityEntries().size();
	} 
	 
	public int getCollectionCount() { 
		return session.getPersistenceContext().getCollectionEntries().size();
	} 
	 
	public Set getEntityKeys() {
		return Collections.unmodifiableSet( session.getPersistenceContext().getEntitiesByKey().keySet() );
	} 
	 
	public Set getCollectionKeys() {
		return Collections.unmodifiableSet( session.getPersistenceContext().getCollectionsByKey().keySet() );
	} 
	 
7
CodeRank
This code example shows how to use the following methods:getPersistenceContext

8
CodeRank
This code example shows how to use the following methods:getContextEntityIdentifier, getEntityPersister, getFactory, getInterceptor, getPersistenceContext
 
	/** 
	 * {@inheritDoc} 
	 */ 
	public Serializable generate(SessionImplementor sessionImplementor, Object object) {
		Session session = ( Session ) sessionImplementor;
 
		final EntityPersister persister = sessionImplementor.getFactory().getEntityPersister( entityName );
		Object associatedObject = persister.getPropertyValue( object, propertyName );
		if ( associatedObject == null ) { 
			throw new IdentifierGenerationException(
					"attempted to assign id from null one-to-one property [" + getRole() + "]"
			); 
		} 
 
		final EntityType foreignValueSourceType;
		final Type propertyType = persister.getPropertyType( propertyName );
		if ( propertyType.isEntityType() ) {
			// the normal case 
			foreignValueSourceType = (EntityType) propertyType;

7
CodeRank
This code example shows how to use the following methods:getPersistenceContext
			result[ index.intValue() ] = elementType.disassemble( object, getSession(), null ); 
		} 
		return result; 
	} 
 
 
} 
7
CodeRank
This code example shows how to use the following methods:getPersistenceContext

8
CodeRank
This code example shows how to use the following methods:getPersistenceContext
	/** 
	 * @see LockingStrategy#lock 
	 */ 
	public void lock( 
			Serializable id,
			Object version, 
			Object object, 
			int timeout, SessionImplementor session) throws StaleObjectStateException, JDBCException {
		if ( !lockable.isVersioned() ) {
			throw new HibernateException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
		} 
		EntityEntry entry = session.getPersistenceContext().getEntry( object );
		EntityIncrementVersionProcess incrementVersion = new EntityIncrementVersionProcess( object, entry );
		EventSource source = (EventSource) session;
		// Register the EntityIncrementVersionProcess action to run just prior to transaction commit.  
		source.getActionQueue().registerProcess( incrementVersion );
	} 
 
	protected LockMode getLockMode() {
		return lockMode;
7
CodeRank
This code example shows how to use the following methods:getPersistenceContext

7
CodeRank
This code example shows how to use the following methods:getPersistenceContext
 
   /** 
	 * @see org.hibernate.dialect.lock.LockingStrategy#lock 
	 */ 
	public void lock( 
      Serializable id,
      Object version, 
      Object object, 
      int timeout, SessionImplementor session) throws StaleObjectStateException, JDBCException {
		if ( !lockable.isVersioned() ) {
			throw new OptimisticLockException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
		} 
		EntityEntry entry = session.getPersistenceContext().getEntry(object);
		EventSource source = (EventSource)session;
		EntityVerifyVersionProcess verifyVersion = new EntityVerifyVersionProcess(object, entry);
		// Register the EntityVerifyVersionProcess action to run just prior to transaction commit. 
		source.getActionQueue().registerProcess(verifyVersion);
	} 
 
	protected LockMode getLockMode() {
7
CodeRank
This code example shows how to use the following methods:getContextEntityIdentifier, getFactory, getPersistenceContext, internalLoad

6
CodeRank
getPersistenceContext Method Overview
Get the persistence context for this session
See Code Examples for other Hibernate ORM SessionImplementor Methods: