Skip to content

Commit 3eb4d5f

Browse files
gavinkingDavideD
authored andcommitted
add StatelessSession.getIdentifier() because repositories need it
this was already added to ORM SS in 6.6
1 parent 6a0fed0 commit 3eb4d5f

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/Mutiny.java

+11
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,17 @@ default Uni<Void> refresh(Object entity, LockModeType lockModeType) {
18611861
*/
18621862
<T> Uni<T> fetch(T association);
18631863

1864+
/**
1865+
* Return the identifier value of the given entity, which may be detached.
1866+
*
1867+
* @param entity a persistent instance associated with this session
1868+
*
1869+
* @return the identifier
1870+
*
1871+
* @since 3.0
1872+
*/
1873+
Object getIdentifier(Object entity);
1874+
18641875
/**
18651876
* Obtain a native SQL result set mapping defined via the annotation
18661877
* {@link jakarta.persistence.SqlResultSetMapping}.

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/impl/MutinyStatelessSessionImpl.java

+5
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ public <T> Uni<T> fetch(T association) {
193193
return uni( () -> delegate.reactiveFetch( association, false ) );
194194
}
195195

196+
@Override
197+
public Object getIdentifier(Object entity) {
198+
return delegate.getIdentifier(entity);
199+
}
200+
196201
// @Override
197202
// public <T> ResultSetMapping<T> getResultSetMapping(Class<T> resultType, String mappingName) {
198203
// return delegate.getResultSetMapping( resultType, mappingName );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/ReactiveStatelessSession.java

+2
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ public interface ReactiveStatelessSession extends ReactiveQueryProducer, Reactiv
7171
boolean isOpen();
7272

7373
void close(CompletableFuture<Void> closing);
74+
75+
Object getIdentifier(Object entity);
7476
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/stage/Stage.java

+11
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,17 @@ default CompletionStage<Void> refresh(Object entity, LockModeType lockModeType)
19001900
*/
19011901
<T> CompletionStage<T> fetch(T association);
19021902

1903+
/**
1904+
* Return the identifier value of the given entity, which may be detached.
1905+
*
1906+
* @param entity a persistent instance associated with this session
1907+
*
1908+
* @return the identifier
1909+
*
1910+
* @since 3.0
1911+
*/
1912+
Object getIdentifier(Object entity);
1913+
19031914
/**
19041915
* Obtain a native SQL result set mapping defined via the annotation
19051916
* {@link jakarta.persistence.SqlResultSetMapping}.

hibernate-reactive-core/src/main/java/org/hibernate/reactive/stage/impl/StageStatelessSessionImpl.java

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ public <T> CompletionStage<T> fetch(T association) {
132132
return delegate.reactiveFetch( association, false );
133133
}
134134

135+
@Override
136+
public Object getIdentifier(Object entity) {
137+
return delegate.getIdentifier(entity);
138+
}
139+
135140
@Override
136141
public <T> CompletionStage<T> withTransaction(Function<Stage.Transaction, CompletionStage<T>> work) {
137142
return currentTransaction == null

0 commit comments

Comments
 (0)