clean up some warnings

This commit is contained in:
Gavin King 2021-12-25 13:05:59 +01:00 committed by Steve Ebersole
parent 9d0ee368ca
commit a25aa20187
5 changed files with 17 additions and 20 deletions

View File

@ -172,16 +172,21 @@ public interface SessionFactory extends EntityManagerFactory, HibernateEntityMan
default <R> R fromTransaction(Function<Session,R> action) {
return fromSession(
session -> {
R result = null;
final Transaction txn = session.beginTransaction();
try {
result = action.apply( session );
R result = action.apply( session );
if ( !txn.isActive() ) {
throw new TransactionManagementException( "Execution of action caused managed transaction to be completed" );
}
// action completed with no errors - attempt to commit the transaction allowing
// any RollbackException to propagate. Note that when we get here we know the
// txn is active
txn.commit();
return result;
}
catch (RuntimeException e) {
// an error happened in the action
@ -195,14 +200,6 @@ public interface SessionFactory extends EntityManagerFactory, HibernateEntityMan
throw e;
}
// action completed with no errors - attempt to commit the transaction allowing
// any RollbackException to propagate. Note that when we get here we know the
// txn is active
txn.commit();
return result;
}
);
}
@ -248,7 +245,7 @@ public interface SessionFactory extends EntityManagerFactory, HibernateEntityMan
*
* @return The set of filter names.
*/
Set getDefinedFilterNames();
Set<String> getDefinedFilterNames();
/**
* Obtain the definition of a filter by name.
@ -285,7 +282,7 @@ public interface SessionFactory extends EntityManagerFactory, HibernateEntityMan
* @deprecated Use the descriptors from {@link #getMetamodel()} instead
*/
@Deprecated
ClassMetadata getClassMetadata(Class entityClass);
ClassMetadata getClassMetadata(@SuppressWarnings("rawtypes") Class entityClass);
/**
* Retrieve the {@link ClassMetadata} associated with the given entity class.

View File

@ -188,7 +188,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
}
@Override
public Set getDefinedFilterNames() {
public Set<String> getDefinedFilterNames() {
return delegate.getDefinedFilterNames();
}

View File

@ -1010,7 +1010,7 @@ public class SessionFactoryImpl implements SessionFactoryImplementor {
return fetchProfiles.containsKey( name );
}
public Set getDefinedFilterNames() {
public Set<String> getDefinedFilterNames() {
return filters.keySet();
}

View File

@ -27,11 +27,11 @@ public interface SessionStatistics {
* Get the set of all {@code EntityKey}s
* @see org.hibernate.engine.spi.EntityKey
*/
Set getEntityKeys();
Set<?> getEntityKeys();
/**
* Get the set of all {@code CollectionKey}s
* @see org.hibernate.engine.spi.CollectionKey
*/
Set getCollectionKeys();
Set<?> getCollectionKeys();
}

View File

@ -31,11 +31,11 @@ public class SessionStatisticsImpl implements SessionStatistics {
return session.getPersistenceContextInternal().getCollectionEntriesSize();
}
public Set getEntityKeys() {
public Set<?> getEntityKeys() {
return Collections.unmodifiableSet( session.getPersistenceContextInternal().getEntitiesByKey().keySet() );
}
public Set getCollectionKeys() {
public Set<?> getCollectionKeys() {
return Collections.unmodifiableSet( session.getPersistenceContextInternal().getCollectionsByKey().keySet() );
}