102
102
* behavior is appropriate for programs which use optimistic locking.
103
103
* <ul>
104
104
* <li>A different lock level may be obtained by explicitly specifying the mode using
105
- * {@link #get (Class, Object, LockMode )}, {@link #find(Class, Object, LockModeType )},
106
- * {@link #refresh(Object, LockMode )}, {@link #refresh(Object, LockModeType )}, or
107
- * {@link org.hibernate.query.SelectionQuery#setLockMode(LockModeType)}.
105
+ * {@link #find (Class,Object,LockModeType )}, {@link #find(Class,Object,FindOption... )},
106
+ * {@link #refresh(Object,LockModeType )}, {@link #refresh(Object,RefreshOption... )},
107
+ * or {@link org.hibernate.query.SelectionQuery#setLockMode(LockModeType)}.
108
108
* <li>The lock level of a managed instance already held by the session may be upgraded
109
109
* to a more restrictive lock level by calling {@link #lock(Object, LockMode)} or
110
110
* {@link #lock(Object, LockModeType)}.
@@ -802,7 +802,8 @@ public interface Session extends SharedSessionContract, EntityManager {
802
802
* with {@link jakarta.persistence.CascadeType#REFRESH}.
803
803
* <p>
804
804
* This operation requests {@link LockMode#READ}. To obtain a stronger lock,
805
- * call {@link #refresh(Object, LockMode)}.
805
+ * call {@link #refresh(Object, RefreshOption...)}, passing the appropriate
806
+ * {@link LockMode} as an option.
806
807
*
807
808
* @param object a persistent instance associated with this session
808
809
*/
@@ -938,6 +939,24 @@ public interface Session extends SharedSessionContract, EntityManager {
938
939
@ Deprecated (since = "7.0" , forRemoval = true )
939
940
Object get (String entityName , Object id , LockMode lockMode );
940
941
942
+ /**
943
+ * Return the persistent instance of the given entity class with the given identifier,
944
+ * or null if there is no such persistent instance. If the instance is already associated
945
+ * with the session, return that instance. This method never returns an uninitialized
946
+ * instance. Obtain the specified lock mode if the instance exists.
947
+ *
948
+ * @param entityType the entity type
949
+ * @param id an identifier
950
+ * @param lockOptions the lock mode
951
+ *
952
+ * @return a persistent instance or null
953
+ *
954
+ * @deprecated This method will be removed.
955
+ * Use {@link #find(Class, Object, FindOption...)} instead.
956
+ */
957
+ @ Deprecated (since = "7.0" , forRemoval = true )
958
+ <T > T get (Class <T > entityType , Object id , LockOptions lockOptions );
959
+
941
960
/**
942
961
* Return the persistent instance of the given entity class with the given identifier,
943
962
* or null if there is no such persistent instance. If the instance is already associated
@@ -950,7 +969,11 @@ public interface Session extends SharedSessionContract, EntityManager {
950
969
*
951
970
* @return a persistent instance or null
952
971
*
953
- * @deprecated Use {@linkplain #find(Class, Object, FindOption...)} instead
972
+ * @deprecated This method will be removed.
973
+ * Use {@link SessionFactory#createGraphForDynamicEntity(String)}
974
+ * together with {@link #find(EntityGraph, Object, FindOption...)}
975
+ * to load {@link org.hibernate.metamodel.RepresentationMode#MAP
976
+ * dynamic entities}.
954
977
*/
955
978
@ Deprecated (since = "7.0" , forRemoval = true )
956
979
Object get (String entityName , Object id , LockOptions lockOptions );
@@ -967,7 +990,8 @@ public interface Session extends SharedSessionContract, EntityManager {
967
990
*
968
991
* @since 6.2
969
992
*
970
- * @deprecated Use {@linkplain #lock(Object, LockModeType, LockOption...)} instead
993
+ * @deprecated This method will be removed.
994
+ * Use {@linkplain #lock(Object, LockModeType, LockOption...)} instead
971
995
*/
972
996
@ Deprecated (since = "7.0" , forRemoval = true )
973
997
void lock (Object object , LockOptions lockOptions );
@@ -979,7 +1003,8 @@ public interface Session extends SharedSessionContract, EntityManager {
979
1003
* @param object a persistent instance associated with this session
980
1004
* @param lockOptions contains the lock mode to use
981
1005
*
982
- * @deprecated Use {@linkplain #refresh(Object, RefreshOption...)} instead
1006
+ * @deprecated This method will be removed.
1007
+ * Use {@linkplain #refresh(Object, RefreshOption...)} instead
983
1008
*/
984
1009
@ Deprecated (since = "7.0" , forRemoval = true )
985
1010
void refresh (Object object , LockOptions lockOptions );
0 commit comments