Skip to content

Commit

Permalink
add StatelessSession.getIdentifier() because repositories need it
Browse files Browse the repository at this point in the history
this was already added to ORM SS in 6.6
  • Loading branch information
gavinking committed Dec 18, 2024
1 parent 84a8b13 commit 87361ff
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,17 @@ default Uni<Void> refresh(Object entity, LockModeType lockModeType) {
*/
<T> Uni<T> fetch(T association);

/**
* Return the identifier value of the given entity, which may be detached.
*
* @param entity a persistent instance associated with this session
*
* @return the identifier
*
* @since 3.0
*/
Object getIdentifier(Object entity);

/**
* Obtain a native SQL result set mapping defined via the annotation
* {@link jakarta.persistence.SqlResultSetMapping}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ public <T> Uni<T> fetch(T association) {
return uni( () -> delegate.reactiveFetch( association, false ) );
}

@Override
public Object getIdentifier(Object entity) {
return delegate.getIdentifier(entity);
}

// @Override
// public <T> ResultSetMapping<T> getResultSetMapping(Class<T> resultType, String mappingName) {
// return delegate.getResultSetMapping( resultType, mappingName );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ public interface ReactiveStatelessSession extends ReactiveQueryProducer, Reactiv
boolean isOpen();

void close(CompletableFuture<Void> closing);

Object getIdentifier(Object entity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,17 @@ default CompletionStage<Void> refresh(Object entity, LockModeType lockModeType)
*/
<T> CompletionStage<T> fetch(T association);

/**
* Return the identifier value of the given entity, which may be detached.
*
* @param entity a persistent instance associated with this session
*
* @return the identifier
*
* @since 3.0
*/
Object getIdentifier(Object entity);

/**
* Obtain a native SQL result set mapping defined via the annotation
* {@link jakarta.persistence.SqlResultSetMapping}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public <T> CompletionStage<T> fetch(T association) {
return delegate.reactiveFetch( association, false );
}

@Override
public Object getIdentifier(Object entity) {
return delegate.getIdentifier(entity);
}

@Override
public <T> CompletionStage<T> withTransaction(Function<Stage.Transaction, CompletionStage<T>> work) {
return currentTransaction == null
Expand Down

0 comments on commit 87361ff

Please sign in to comment.