org.hibernate.CustomEntityDirtinessStrategy Java Examples

The following examples show how to use org.hibernate.CustomEntityDirtinessStrategy. 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: AbstractEntityEntry.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings( {"SimplifiableIfStatement"})
private boolean isUnequivocallyNonDirty(Object entity) {
	if ( entity instanceof SelfDirtinessTracker ) {
		return ! persister.hasCollections() && ! ( (SelfDirtinessTracker) entity ).$$_hibernate_hasDirtyAttributes();
	}

	final CustomEntityDirtinessStrategy customEntityDirtinessStrategy =
			getPersistenceContext().getSession().getFactory().getCustomEntityDirtinessStrategy();
	if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) getPersistenceContext().getSession() ) ) {
		return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) getPersistenceContext().getSession() );
	}

	if ( getPersister().hasMutableProperties() ) {
		return false;
	}

	return false;
}
 
Example #2
Source File: DefaultFlushEntityEventListener.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public int[] visitAttributes(CustomEntityDirtinessStrategy.AttributeChecker attributeChecker) {
	databaseSnapshot = null;
	index = 0;

	final int[] indexes = new int[numberOfAttributes];
	int count = 0;
	for (; index < numberOfAttributes; index++ ) {
		if ( attributeChecker.isDirty( this ) ) {
			indexes[count++] = index;
		}
	}
	return Arrays.copyOf( indexes, count );
}
 
Example #3
Source File: SessionFactoryDelegatingImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() {
	return delegate.getCustomEntityDirtinessStrategy();
}
 
Example #4
Source File: SessionFactoryImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() {
	return getSessionFactoryOptions().getCustomEntityDirtinessStrategy();
}
 
Example #5
Source File: AbstractDelegatingSessionFactoryOptions.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() {
	return delegate.getCustomEntityDirtinessStrategy();
}
 
Example #6
Source File: AbstractDelegatingSessionFactoryBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public T applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy) {
	delegate.applyCustomEntityDirtinessStrategy( strategy );
	return getThis();
}
 
Example #7
Source File: SessionFactoryOptionsBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() {
	return customEntityDirtinessStrategy;
}
 
Example #8
Source File: SessionFactoryOptionsBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy) {
	this.customEntityDirtinessStrategy = strategy;
}
 
Example #9
Source File: SessionFactoryBuilderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SessionFactoryBuilder applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy) {
	this.optionsBuilder.applyCustomEntityDirtinessStrategy( strategy );
	return this;
}
 
Example #10
Source File: SessionFactoryWrapper.java    From lemon with Apache License 2.0 4 votes vote down vote up
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy() {
    return sessionFactoryImplementor.getCustomEntityDirtinessStrategy();
}
 
Example #11
Source File: SessionFactoryImplementor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @todo make a Service ?
 */
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();
 
Example #12
Source File: SessionFactoryBuilder.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specifies a custom entity dirtiness strategy to be applied to the SessionFactory.  See the contract
 * of {@link org.hibernate.CustomEntityDirtinessStrategy} for details.
 *
 * @param strategy The custom strategy to be used.
 *
 * @return {@code this}, for method chaining
 *
 * @see org.hibernate.cfg.AvailableSettings#CUSTOM_ENTITY_DIRTINESS_STRATEGY
 */
SessionFactoryBuilder applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy);
 
Example #13
Source File: SessionFactoryOptions.java    From lams with GNU General Public License v2.0 votes vote down vote up
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();