Skip to content

add StatelessSession.getIdentifier() because repositories need it #2039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading