Skip to content

Commit

Permalink
Implemented EntityTypeDescriptor methods and throw NotYetImplementedF…
Browse files Browse the repository at this point in the history
…or6Exception for method not implemented
  • Loading branch information
dreab8 committed Feb 26, 2019
1 parent 259ac6d commit ccd5984
Show file tree
Hide file tree
Showing 25 changed files with 536 additions and 287 deletions.
Expand Up @@ -167,7 +167,7 @@ public int compareTo(Object other) {
}
else {
//then by id
return entityDescriptor.getIdentifierType().getJavaTypeDescriptor().getComparator().compare( id, action.id );
return entityDescriptor.getIdentifierDescriptor().getJavaTypeDescriptor().getComparator().compare( id, action.id );
}
}

Expand Down
Expand Up @@ -36,4 +36,8 @@ default PersistenceType getPersistenceType() {
Class getProxyInterface();

ExecuteUpdateResultCheckStyle getUpdateResultCheckStyle();

Class getMappedClass();

int getBatchSize();
}
Expand Up @@ -195,7 +195,7 @@ public Object[] getEntityBatch(
//the first id found after the given id
return ids;
}
if ( entityDescriptor.getIdentifierType().getJavaTypeDescriptor().areEqual( id, key.getIdentifier() ) ) {
if ( entityDescriptor.getIdentifierDescriptor().getJavaTypeDescriptor().areEqual( id, key.getIdentifier() ) ) {
end = i;
}
else {
Expand Down
Expand Up @@ -273,8 +273,10 @@ protected void entityIsDetached(MergeEvent event, Map copyCache) {
source.getLoadQueryInfluencers().setEnabledInternalFetchProfileType( InternalFetchProfileType.MERGE );
//we must clone embedded composite identifiers, or
//we will get back the same instance that we pass in
final Serializable clonedIdentifier = (Serializable) entityDescriptor.getIdentifierType().getJavaTypeDescriptor()
.getMutabilityPlan().deepCopy( id );
final Serializable clonedIdentifier = (Serializable) entityDescriptor.getIdentifierDescriptor()
.getJavaTypeDescriptor()
.getMutabilityPlan()
.deepCopy( id );
result = source.get( entityName, clonedIdentifier );
}
finally {
Expand Down
Expand Up @@ -121,7 +121,7 @@ protected Object entityIsPersistent(SaveOrUpdateEvent event) throws HibernateExc
}
else {

final boolean isEqual = !entityEntry.getDescriptor().getIdentifierType()
final boolean isEqual = !entityEntry.getDescriptor().getIdentifierDescriptor()
.getJavaTypeDescriptor().areEqual( requestedId, entityEntry.getId() );

if ( isEqual ) {
Expand Down
Expand Up @@ -19,6 +19,7 @@
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.model.domain.spi.EntityTypeDescriptor;
import org.hibernate.type.Type;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;

/**
* Renders entities and query parameters to a nicely readable string.
Expand Down Expand Up @@ -60,14 +61,14 @@ public String toString(
);
}

Type[] types = entityDescriptor.getPropertyTypes();
JavaTypeDescriptor[] propertyJavaTypeDescriptors = entityDescriptor.getPropertyJavaTypeDescriptors();
String[] names = entityDescriptor.getPropertyNames();
Object[] values = entityDescriptor.getPropertyValues( entity );
for ( int i = 0; i < types.length; i++ ) {
for ( int i = 0; i < propertyJavaTypeDescriptors.length; i++ ) {
if ( !names[i].startsWith( "_" ) ) {
String strValue = values[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY ?
values[i].toString() :
types[i].toLoggableString( values[i] );
propertyJavaTypeDescriptors[i].extractLoggableRepresentation( values[i] );
result.put( names[i], strValue );
}
}
Expand Down
Expand Up @@ -146,6 +146,7 @@ public void setProxyInterfaceName(String proxyInterfaceName) {
this.proxyInterface = null;
}

@Override
public Class getMappedClass() throws MappingException {
if ( className == null ) {
return null;
Expand Down Expand Up @@ -473,6 +474,7 @@ public void createPrimaryKey() {

public abstract String getWhere();

@Override
public int getBatchSize() {
return batchSize;
}
Expand Down

0 comments on commit ccd5984

Please sign in to comment.