2222 */
2323public interface SharedSessionContract extends QueryProducer , AutoCloseable , Serializable {
2424 /**
25- * Obtain the tenant identifier associated with this session.
25+ * Obtain the tenant identifier associated with this session, as a string .
2626 *
2727 * @return The tenant identifier associated with this session, or {@code null}
28+ *
29+ * @see org.hibernate.context.spi.CurrentTenantIdentifierResolver
30+ * @see SessionBuilder#tenantIdentifier(Object)
2831 */
2932 String getTenantIdentifier ();
3033
@@ -33,6 +36,9 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
3336 *
3437 * @return The tenant identifier associated with this session, or {@code null}
3538 * @since 6.4
39+ *
40+ * @see org.hibernate.context.spi.CurrentTenantIdentifierResolver
41+ * @see SessionBuilder#tenantIdentifier(Object)
3642 */
3743 Object getTenantIdentifierValue ();
3844
@@ -41,19 +47,20 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
4147 *
4248 * @throws HibernateException Indicates problems cleaning up.
4349 */
50+ @ Override
4451 void close () throws HibernateException ;
4552
4653 /**
4754 * Check if the session is still open.
4855 *
49- * @return boolean
56+ * @return {@code true} if it is open
5057 */
5158 boolean isOpen ();
5259
5360 /**
5461 * Check if the session is currently connected.
5562 *
56- * @return boolean
63+ * @return {@code true} if it is connected
5764 */
5865 boolean isConnected ();
5966
@@ -62,16 +69,18 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
6269 * If a new underlying transaction is required, begin the transaction. Otherwise,
6370 * continue the new work in the context of the existing underlying transaction.
6471 *
65- * @return a {@link Transaction} instance
72+ * @return an instance of {@link Transaction} representing the new transaction
6673 *
6774 * @see #getTransaction()
75+ * @see Transaction#begin()
6876 */
6977 Transaction beginTransaction ();
7078
7179 /**
7280 * Get the {@link Transaction} instance associated with this session.
7381 *
74- * @return a Transaction instance
82+ * @return an instance of {@link Transaction} representing the transaction
83+ * associated with this session
7584 *
7685 * @see jakarta.persistence.EntityManager#getTransaction()
7786 */
@@ -228,10 +237,11 @@ public interface SharedSessionContract extends QueryProducer, AutoCloseable, Ser
228237 * @param work The work to be performed.
229238 *
230239 * @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}
231243 */
232- default void doWork (Work work ) throws HibernateException {
233- throw new UnsupportedOperationException ();
234- }
244+ void doWork (Work work ) throws HibernateException ;
235245
236246 /**
237247 * Perform work using the {@link java.sql.Connection} underlying by this session,
@@ -243,10 +253,11 @@ default void doWork(Work work) throws HibernateException {
243253 * @return the result of calling {@link ReturningWork#execute}.
244254 *
245255 * @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}
246259 */
247- default <T > T doReturningWork (ReturningWork <T > work ) throws HibernateException {
248- throw new UnsupportedOperationException ();
249- }
260+ <T > T doReturningWork (ReturningWork <T > work );
250261
251262 /**
252263 * Create a new mutable {@link EntityGraph} with only a root node.
0 commit comments