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 @@ default <R> R fromSession(Function<Session,R> action) {
default <R> R fromTransaction(Function<Session,R> action) { default <R> R fromTransaction(Function<Session,R> action) {
return fromSession( return fromSession(
session -> { session -> {
R result = null;
final Transaction txn = session.beginTransaction(); final Transaction txn = session.beginTransaction();
try { try {
result = action.apply( session ); R result = action.apply( session );
if ( !txn.isActive() ) { if ( !txn.isActive() ) {
throw new TransactionManagementException( "Execution of action caused managed transaction to be completed" ); 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) { catch (RuntimeException e) {
// an error happened in the action // an error happened in the action
@ -195,14 +200,6 @@ default <R> R fromTransaction(Function<Session,R> action) {
throw e; 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 @@ default <R> R fromTransaction(Function<Session,R> action) {
* *
* @return The set of filter names. * @return The set of filter names.
*/ */
Set getDefinedFilterNames(); Set<String> getDefinedFilterNames();
/** /**
* Obtain the definition of a filter by name. * Obtain the definition of a filter by name.
@ -285,7 +282,7 @@ default <R> R fromTransaction(Function<Session,R> action) {
* @deprecated Use the descriptors from {@link #getMetamodel()} instead * @deprecated Use the descriptors from {@link #getMetamodel()} instead
*/ */
@Deprecated @Deprecated
ClassMetadata getClassMetadata(Class entityClass); ClassMetadata getClassMetadata(@SuppressWarnings("rawtypes") Class entityClass);
/** /**
* Retrieve the {@link ClassMetadata} associated with the given entity class. * Retrieve the {@link ClassMetadata} associated with the given entity class.

View File

@ -188,7 +188,7 @@ public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph
} }
@Override @Override
public Set getDefinedFilterNames() { public Set<String> getDefinedFilterNames() {
return delegate.getDefinedFilterNames(); return delegate.getDefinedFilterNames();
} }

View File

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

View File

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

View File

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