@Override public boolean equals(Object other) { EntityUniqueKey that = (EntityUniqueKey) other; return that != null && that.entityName.equals( entityName ) && that.uniqueKeyName.equals( uniqueKeyName ) && keyType.isEqual( that.key, key ); }
@Override public boolean equals(Object other) { if ( this == other ) { return true; } if ( other == null || getClass() != other.getClass() ) { return false; } final CollectionKey that = (CollectionKey) other; return that.role.equals( role ) && keyType.isEqual( that.key, key, factory ); }
@Override public boolean equals(Object other) { if ( other == null ) { return false; } if ( this == other ) { return true; } if ( hashCode != other.hashCode() || !( other instanceof CacheKeyImplementation) ) { //hashCode is part of this check since it is pre-calculated and hash must match for equals to be true return false; } final CacheKeyImplementation that = (CacheKeyImplementation) other; return Objects.equals( entityOrRoleName, that.entityOrRoleName ) && type.isEqual( id, that.id ) && Objects.equals( tenantId, that.tenantId ); }
private boolean isSame(Object[] otherValues) { // lengths have already been verified at this point for ( int i = 0; i < naturalIdTypes.length; i++ ) { if ( ! naturalIdTypes[i].isEqual( values[i], otherValues[i], persister.getFactory() ) ) { return false; } } return true; } }
@Override public boolean equals(Object other) { if ( this == other ) { return true; } if ( other == null || getClass() != other.getClass() ) { return false; } final TypedValue that = (TypedValue) other; return type.getReturnedClass() == that.type.getReturnedClass() && type.isEqual( that.value, value ); }
private boolean areEqual(Object newObj, Object oldObj) { // Should a Type have been specified on the property mapper, delegate there to make sure // that proper equality comparison occurs based on the Type's semantics rather than the // generalized EqualsHelper #areEqual call. if ( propertyData.getType() != null ) { return propertyData.getType().isEqual( newObj, oldObj ); } // todo (6.0) - Confirm if this is still necessary as everything should use a JavaTypeDescriptor. // This was maintained for legacy 5.2 behavior only. return Objects.deepEquals( newObj, oldObj ); } }
private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) { // copy the entity state into the state array and return true if the state has changed ClassMetadata metadata = sf.getClassMetadata( entity.getClass() ); Object[] newState = metadata.getPropertyValues( entity ); int size = newState.length; boolean isDirty = false; for ( int index = 0; index < size; index++ ) { if ( ( state[index] == LazyPropertyInitializer.UNFETCHED_PROPERTY && newState[index] != LazyPropertyInitializer.UNFETCHED_PROPERTY ) || ( state[index] != newState[index] && !types[index].isEqual( state[index], newState[index] ) ) ) { isDirty = true; state[index] = newState[index]; } } return isDirty; }
@Override public boolean isEqual(final Object x, final Object y) throws HibernateException { if ( x == y ) { return true; } // null value and empty component are considered equivalent for ( int i = 0; i < propertySpan; i++ ) { if ( !propertyTypes[i].isEqual( getPropertyValue( x, i ), getPropertyValue( y, i ) ) ) { return false; } } return true; }
@Override public boolean isEqual(final Object x, final Object y, final SessionFactoryImplementor factory) throws HibernateException { if ( x == y ) { return true; } // null value and empty component are considered equivalent for ( int i = 0; i < propertySpan; i++ ) { if ( !propertyTypes[i].isEqual( getPropertyValue( x, i ), getPropertyValue( y, i ), factory ) ) { return false; } } return true; }
private boolean sameIdentifier(final EntityKey otherKey) { return persister.getIdentifierType().isEqual( otherKey.identifier, this.identifier, persister.getFactory() ); }
return false; if ( !positionalParameterTypes[i].isEqual( positionalParameterValues[i], that.positionalParameterValues[i] ) ) { return false;
protected Object getObjectFromList(List results, Serializable id, SharedSessionContractImplementor session) { for ( Object obj : results ) { final boolean equal = persister.getIdentifierType().isEqual( id, session.getContextEntityIdentifier( obj ), session.getFactory() ); if ( equal ) { return obj; } } return null; }
protected Object getObjectFromList(List results, Serializable id, SharedSessionContractImplementor session) { for ( Object obj : results ) { final boolean equal = persister.getIdentifierType().isEqual( id, session.getContextEntityIdentifier( obj ), session.getFactory() ); if ( equal ) { return obj; } } return null; }
/** * Removes entity entries that have an equal identifier with the incoming entity instance * * @param list The list containing the entity instances * @param entityInstance The entity instance to match elements. * @param entityName The entity name * @param session The session */ public static void identityRemove( Collection list, Object entityInstance, String entityName, SharedSessionContractImplementor session) { if ( entityInstance != null && ForeignKeys.isNotTransient( entityName, entityInstance, null, session ) ) { final EntityPersister entityPersister = session.getFactory().getEntityPersister( entityName ); final Type idType = entityPersister.getIdentifierType(); final Serializable idOfCurrent = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, entityInstance, session ); final Iterator itr = list.iterator(); while ( itr.hasNext() ) { final Serializable idOfOld = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, itr.next(), session ); if ( idType.isEqual( idOfCurrent, idOfOld, session.getFactory() ) ) { itr.remove(); break; } } } }
if ( persister.getIdentifierType().isEqual( id, key.getIdentifier() ) ) { end = i;
.isEqual( xid, yid, factory );
idType.isEqual( id, resultId, factory );
/** * make sure user didn't mangle the id */ public void checkId(Object object, EntityPersister persister, Serializable id, SessionImplementor session) throws HibernateException { if ( id != null && id instanceof DelayedPostInsertIdentifier ) { // this is a situation where the entity id is assigned by a post-insert generator // and was saved outside the transaction forcing it to be delayed return; } if ( persister.canExtractIdOutOfEntity() ) { Serializable oid = persister.getIdentifier( object, session ); if ( id == null ) { throw new AssertionFailure( "null id in " + persister.getEntityName() + " entry (don't flush the Session after an exception occurs)" ); } if ( !persister.getIdentifierType().isEqual( id, oid, session.getFactory() ) ) { throw new HibernateException( "identifier of an instance of " + persister.getEntityName() + " was altered from " + id + " to " + oid ); } } }
if ( !propertyType.isEqual( current[naturalIdentifierPropertyIndex], snapshot[i] ) ) { throw new HibernateException( String.format(
.isEqual( requestedId, entityEntry.getId(), factory );