22
22
*/
23
23
public interface SharedSessionContract extends QueryProducer , AutoCloseable , Serializable {
24
24
/**
25
- * Obtain the tenant identifier associated with this session.
25
+ * Obtain the tenant identifier associated with this session, as a string .
26
26
*
27
27
* @return The tenant identifier associated with this session, or {@code null}
28
+ *
29
+ * @see org.hibernate.context.spi.CurrentTenantIdentifierResolver
30
+ * @see SessionBuilder#tenantIdentifier(Object)
28
31
*/
29
32
String getTenantIdentifier ();
30
33
@@ -33,6 +36,9 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
33
36
*
34
37
* @return The tenant identifier associated with this session, or {@code null}
35
38
* @since 6.4
39
+ *
40
+ * @see org.hibernate.context.spi.CurrentTenantIdentifierResolver
41
+ * @see SessionBuilder#tenantIdentifier(Object)
36
42
*/
37
43
Object getTenantIdentifierValue ();
38
44
@@ -41,19 +47,20 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
41
47
*
42
48
* @throws HibernateException Indicates problems cleaning up.
43
49
*/
50
+ @ Override
44
51
void close () throws HibernateException ;
45
52
46
53
/**
47
54
* Check if the session is still open.
48
55
*
49
- * @return boolean
56
+ * @return {@code true} if it is open
50
57
*/
51
58
boolean isOpen ();
52
59
53
60
/**
54
61
* Check if the session is currently connected.
55
62
*
56
- * @return boolean
63
+ * @return {@code true} if it is connected
57
64
*/
58
65
boolean isConnected ();
59
66
@@ -62,16 +69,18 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
62
69
* If a new underlying transaction is required, begin the transaction. Otherwise,
63
70
* continue the new work in the context of the existing underlying transaction.
64
71
*
65
- * @return a {@link Transaction} instance
72
+ * @return an instance of {@link Transaction} representing the new transaction
66
73
*
67
74
* @see #getTransaction()
75
+ * @see Transaction#begin()
68
76
*/
69
77
Transaction beginTransaction ();
70
78
71
79
/**
72
80
* Get the {@link Transaction} instance associated with this session.
73
81
*
74
- * @return a Transaction instance
82
+ * @return an instance of {@link Transaction} representing the transaction
83
+ * associated with this session
75
84
*
76
85
* @see jakarta.persistence.EntityManager#getTransaction()
77
86
*/
@@ -228,10 +237,11 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
228
237
* @param work The work to be performed.
229
238
*
230
239
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
240
+ *
241
+ * @apiNote This method competes with the JPA-defined method
242
+ * {@link jakarta.persistence.EntityManager#runWithConnection}
231
243
*/
232
- default void doWork (Work work ) throws HibernateException {
233
- throw new UnsupportedOperationException ();
234
- }
244
+ void doWork (Work work ) throws HibernateException ;
235
245
236
246
/**
237
247
* Perform work using the {@link java.sql.Connection} underlying by this session,
@@ -243,10 +253,11 @@ default void doWork(Work work) throws HibernateException {
243
253
* @return the result of calling {@link ReturningWork#execute}.
244
254
*
245
255
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
256
+ *
257
+ * @apiNote This method competes with the JPA-defined method
258
+ * {@link jakarta.persistence.EntityManager#callWithConnection}
246
259
*/
247
- default <T > T doReturningWork (ReturningWork <T > work ) throws HibernateException {
248
- throw new UnsupportedOperationException ();
249
- }
260
+ <T > T doReturningWork (ReturningWork <T > work );
250
261
251
262
/**
252
263
* Create a new mutable {@link EntityGraph} with only a root node.
0 commit comments