org.hibernate.annotations.OptimisticLockType Java Examples

The following examples show how to use org.hibernate.annotations.OptimisticLockType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
OptimisticLockStyle getVersioning(OptimisticLockType type) {
	switch ( type ) {
		case VERSION:
			return OptimisticLockStyle.VERSION;
		case NONE:
			return OptimisticLockStyle.NONE;
		case DIRTY:
			return OptimisticLockStyle.DIRTY;
		case ALL:
			return OptimisticLockStyle.ALL;
		default:
			throw new AssertionFailure( "optimistic locking not supported: " + type );
	}
}
 
Example #2
Source File: EntityBinder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("SimplifiableConditionalExpression")
private void bindHibernateAnnotation(org.hibernate.annotations.Entity hibAnn) {
	{
		final DynamicInsert dynamicInsertAnn = annotatedClass.getAnnotation( DynamicInsert.class );
		this.dynamicInsert = dynamicInsertAnn == null
				? ( hibAnn == null ? false : hibAnn.dynamicInsert() )
				: dynamicInsertAnn.value();
	}

	{
		final DynamicUpdate dynamicUpdateAnn = annotatedClass.getAnnotation( DynamicUpdate.class );
		this.dynamicUpdate = dynamicUpdateAnn == null
				? ( hibAnn == null ? false : hibAnn.dynamicUpdate() )
				: dynamicUpdateAnn.value();
	}

	{
		final SelectBeforeUpdate selectBeforeUpdateAnn = annotatedClass.getAnnotation( SelectBeforeUpdate.class );
		this.selectBeforeUpdate = selectBeforeUpdateAnn == null
				? ( hibAnn == null ? false : hibAnn.selectBeforeUpdate() )
				: selectBeforeUpdateAnn.value();
	}

	{
		final OptimisticLocking optimisticLockingAnn = annotatedClass.getAnnotation( OptimisticLocking.class );
		this.optimisticLockType = optimisticLockingAnn == null
				? ( hibAnn == null ? OptimisticLockType.VERSION : hibAnn.optimisticLock() )
				: optimisticLockingAnn.type();
	}

	{
		final Polymorphism polymorphismAnn = annotatedClass.getAnnotation( Polymorphism.class );
		this.polymorphismType = polymorphismAnn == null
				? ( hibAnn == null ? PolymorphismType.IMPLICIT : hibAnn.polymorphism() )
				: polymorphismAnn.type();
	}

	if ( hibAnn != null ) {
		// used later in bind for logging
		explicitHibernateEntityAnnotation = true;
		//persister handled in bind
	}
}