HHH-7513 Corrected trace logging for collections using property-refs
This commit is contained in:
parent
847bbc2a36
commit
375c72175a
|
@ -258,11 +258,7 @@ public final class MessageHelper {
|
||||||
s.append( persister.getRole() );
|
s.append( persister.getRole() );
|
||||||
s.append( "#<" );
|
s.append( "#<" );
|
||||||
for ( int i = 0; i < ids.length; i++ ) {
|
for ( int i = 0; i < ids.length; i++ ) {
|
||||||
// Need to use the identifier type of the collection owner
|
addIdToCollectionInfoString( persister, ids[i], factory, s );
|
||||||
// since the incoming is value is actually the owner's id.
|
|
||||||
// Using the collection's key type causes problems with
|
|
||||||
// property-ref keys...
|
|
||||||
s.append( persister.getOwnerEntityPersister().getIdentifierType().toLoggableString( ids[i], factory ) );
|
|
||||||
if ( i < ids.length-1 ) {
|
if ( i < ids.length-1 ) {
|
||||||
s.append( ", " );
|
s.append( ", " );
|
||||||
}
|
}
|
||||||
|
@ -299,11 +295,7 @@ public final class MessageHelper {
|
||||||
s.append( "<null>" );
|
s.append( "<null>" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Need to use the identifier type of the collection owner
|
addIdToCollectionInfoString( persister, id, factory, s );
|
||||||
// since the incoming is value is actually the owner's id.
|
|
||||||
// Using the collection's key type causes problems with
|
|
||||||
// property-ref keys...
|
|
||||||
s.append( persister.getOwnerEntityPersister().getIdentifierType().toLoggableString( id, factory ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.append( ']' );
|
s.append( ']' );
|
||||||
|
@ -311,6 +303,27 @@ public final class MessageHelper {
|
||||||
return s.toString();
|
return s.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addIdToCollectionInfoString(
|
||||||
|
CollectionPersister persister,
|
||||||
|
Serializable id,
|
||||||
|
SessionFactoryImplementor factory,
|
||||||
|
StringBuilder s ) {
|
||||||
|
// Need to use the identifier type of the collection owner
|
||||||
|
// since the incoming is value is actually the owner's id.
|
||||||
|
// Using the collection's key type causes problems with
|
||||||
|
// property-ref keys.
|
||||||
|
// Also need to check that the expected identifier type matches
|
||||||
|
// the given ID. Due to property-ref keys, the collection key
|
||||||
|
// may not be the owner key.
|
||||||
|
Type identifierType = persister.getOwnerEntityPersister()
|
||||||
|
.getIdentifierType();
|
||||||
|
if ( id.getClass().isAssignableFrom(
|
||||||
|
identifierType.getReturnedClass() ) ) {
|
||||||
|
s.append( identifierType.toLoggableString( id, factory ) );
|
||||||
|
}
|
||||||
|
// TODO: If the collection key was not the owner key,
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an info message string relating to a particular managed
|
* Generate an info message string relating to a particular managed
|
||||||
* collection.
|
* collection.
|
||||||
|
|
Loading…
Reference in New Issue