Skip to content

Commit a22e8e5

Browse files
committed
get rid of extremely useless log messages
These messages were added in HHH-7454 and HHH-11426. - I'm pretty sure that the claim made in HHH-7454 is simply incorrect, whereas the message added in - On the other hand, HHH-11426 is warning about an error that might, but probably won't occur.
1 parent b6990d2 commit a22e8e5

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

hibernate-core/src/main/java/org/hibernate/jpa/internal/PersistenceUnitUtilImpl.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @author Steve Ebersole
3131
*/
3232
public class PersistenceUnitUtilImpl implements PersistenceUnitUtil, Serializable {
33-
private static final Logger log = Logger.getLogger( PersistenceUnitUtilImpl.class );
3433

3534
private final SessionFactoryImplementor sessionFactory;
3635
private final transient PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache();
@@ -41,16 +40,11 @@ public PersistenceUnitUtilImpl(SessionFactoryImplementor sessionFactory) {
4140

4241
@Override
4342
public boolean isLoaded(Object entity, String attributeName) {
44-
// added log message to help with HHH-7454, if state == LoadState,NOT_LOADED, returning true or false is not accurate.
45-
log.debug( "PersistenceUnitUtil#isLoaded is not always accurate; consider using EntityManager#contains instead" );
46-
switch ( isLoadedWithoutReference( entity, attributeName, cache ) ) {
47-
case LOADED:
48-
return true;
49-
case NOT_LOADED:
50-
return false;
51-
default:
52-
return isLoadedWithReference( entity, attributeName, cache ) != NOT_LOADED;
53-
}
43+
return switch ( isLoadedWithoutReference( entity, attributeName, cache ) ) {
44+
case LOADED -> true;
45+
case NOT_LOADED -> false;
46+
default -> isLoadedWithReference( entity, attributeName, cache ) != NOT_LOADED;
47+
};
5448
}
5549

5650
@Override
@@ -60,8 +54,6 @@ public <E> boolean isLoaded(E entity, Attribute<? super E, ?> attribute) {
6054

6155
@Override
6256
public boolean isLoaded(Object entity) {
63-
// added log message to help with HHH-7454, if state == LoadState,NOT_LOADED, returning true or false is not accurate.
64-
log.debug( "PersistenceUnitUtil#isLoaded is not always accurate; consider using EntityManager#contains instead" );
6557
return getLoadState( entity ) != NOT_LOADED;
6658
}
6759

@@ -106,17 +98,10 @@ else if ( isManagedEntity( entity ) ) {
10698
return entityEntry.getId();
10799
}
108100
else {
109-
// HHH-11426 - best effort to deal with the case of detached entities
110-
log.debug( "jakarta.persistence.PersistenceUnitUtil.getIdentifier may not be able to read identifier of a detached entity" );
111101
return getIdentifierFromPersister( entity );
112102
}
113103
}
114104
else {
115-
log.debug(
116-
"jakarta.persistence.PersistenceUnitUtil.getIdentifier is only intended to work with enhanced entities " +
117-
"(although Hibernate also adapts this support to its proxies); " +
118-
"however the passed entity was not enhanced (nor a proxy).. may not be able to read identifier"
119-
);
120105
return getIdentifierFromPersister( entity );
121106
}
122107
}

0 commit comments

Comments
 (0)