Skip to content

Commit bbbaf51

Browse files
committed
HHH-18539 remove Session.load()
Signed-off-by: Gavin King <[email protected]>
1 parent e407c53 commit bbbaf51

File tree

7 files changed

+1
-209
lines changed

7 files changed

+1
-209
lines changed

hibernate-core/src/main/java/org/hibernate/Session.java

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -476,115 +476,6 @@ public interface Session extends SharedSessionContract, EntityManager {
476476
*/
477477
void evict(Object object);
478478

479-
/**
480-
* Return the persistent instance of the given entity class with the given identifier,
481-
* obtaining the specified lock mode, assuming the instance exists.
482-
* <p>
483-
* Convenient form of {@link #load(Class, Object, LockOptions)}.
484-
*
485-
* @param theClass a persistent class
486-
* @param id a valid identifier of an existing persistent instance of the class
487-
* @param lockMode the lock level
488-
*
489-
* @return the persistent instance or proxy
490-
*
491-
* @see #load(Class, Object, LockOptions)
492-
*
493-
* @deprecated use {@link #get(Class, Object, LockMode)}
494-
*/
495-
@Deprecated(since = "6.0")
496-
<T> T load(Class<T> theClass, Object id, LockMode lockMode);
497-
498-
/**
499-
* Return the persistent instance of the given entity class with the given identifier,
500-
* obtaining the specified lock mode, assuming the instance exists.
501-
*
502-
* @param theClass a persistent class
503-
* @param id a valid identifier of an existing persistent instance of the class
504-
* @param lockOptions contains the lock level
505-
* @return the persistent instance or proxy
506-
*
507-
* @deprecated use {@link #get(Class, Object, LockOptions)}
508-
*/
509-
@Deprecated(since = "6.0")
510-
<T> T load(Class<T> theClass, Object id, LockOptions lockOptions);
511-
512-
/**
513-
* Return the persistent instance of the given entity class with the given identifier,
514-
* obtaining the specified lock mode, assuming the instance exists.
515-
* <p>
516-
* Convenient form of {@link #load(String, Object, LockOptions)}.
517-
*
518-
* @param entityName the entity name
519-
* @param id a valid identifier of an existing persistent instance of the class
520-
* @param lockMode the lock level
521-
*
522-
* @return the persistent instance or proxy
523-
*
524-
* @see #load(String, Object, LockOptions)
525-
*
526-
* @deprecated use {@link #get(String, Object, LockMode)}
527-
*/
528-
@Deprecated(since = "6.0")
529-
Object load(String entityName, Object id, LockMode lockMode);
530-
531-
/**
532-
* Return the persistent instance of the given entity class with the given identifier,
533-
* obtaining the specified lock mode, assuming the instance exists.
534-
*
535-
* @param entityName the entity name
536-
* @param id a valid identifier of an existing persistent instance of the class
537-
* @param lockOptions contains the lock level
538-
*
539-
* @return the persistent instance or proxy
540-
*
541-
* @deprecated use {@link #get(String, Object, LockOptions)}
542-
*/
543-
@Deprecated(since = "6.0")
544-
Object load(String entityName, Object id, LockOptions lockOptions);
545-
546-
/**
547-
* Return the persistent instance of the given entity class with the given identifier,
548-
* making the assumption that the instance exists in the database. This method might
549-
* return a proxied instance that is initialized on-demand, when a non-identifier method
550-
* is accessed.
551-
* <p>
552-
* You should not use this method to determine if an instance exists in the database
553-
* (use {@code get()} instead). Use this only to retrieve an instance that you assume
554-
* exists, where non-existence would be an actual error.
555-
* <p>
556-
* This operation is very similar to {@link #getReference(Class, Object)}.
557-
*
558-
* @param theClass a persistent class
559-
* @param id a valid identifier of an existing persistent instance of the class
560-
*
561-
* @return the persistent instance or proxy
562-
*
563-
* @deprecated use {@link #getReference(Class, Object)}
564-
*/
565-
@Deprecated(since = "6.0")
566-
<T> T load(Class<T> theClass, Object id);
567-
568-
/**
569-
* Return the persistent instance of the given entity class with the given identifier,
570-
* making the assumption that the instance exists in the database. This method might
571-
* return a proxied instance that is initialized on-demand, when a non-identifier
572-
* method is accessed.
573-
* <p>
574-
* You should not use this method to determine if an instance exists in the database
575-
* (use {@code get()} instead). Use this only to retrieve an instance that you assume
576-
* exists, where non-existence would be an actual error.
577-
*
578-
* @param entityName the entity name
579-
* @param id a valid identifier of an existing persistent instance of the class
580-
*
581-
* @return the persistent instance or proxy
582-
*
583-
* @deprecated use {@link #getReference(String, Object)}
584-
*/
585-
@Deprecated(since = "6.0")
586-
Object load(String entityName, Object id);
587-
588479
/**
589480
* Read the persistent state associated with the given identifier into the given
590481
* transient instance.

hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
3838
import org.hibernate.engine.jdbc.spi.JdbcServices;
3939
import org.hibernate.event.spi.EventManager;
40-
import org.hibernate.event.spi.DeleteContext;
4140
import org.hibernate.event.spi.EventSource;
4241
import org.hibernate.event.spi.MergeContext;
4342
import org.hibernate.event.spi.PersistContext;
44-
import org.hibernate.event.spi.RefreshContext;
4543
import org.hibernate.graph.RootGraph;
4644
import org.hibernate.graph.spi.RootGraphImplementor;
4745
import org.hibernate.jdbc.ReturningWork;
@@ -812,36 +810,6 @@ public void evict(Object object) {
812810
delegate.evict( object );
813811
}
814812

815-
@Override
816-
public <T> T load(Class<T> theClass, Object id, LockMode lockMode) {
817-
return delegate.load( theClass, id, lockMode );
818-
}
819-
820-
@Override
821-
public <T> T load(Class<T> theClass, Object id, LockOptions lockOptions) {
822-
return delegate.load( theClass, id, lockOptions );
823-
}
824-
825-
@Override
826-
public Object load(String entityName, Object id, LockMode lockMode) {
827-
return delegate.load( entityName, id, lockMode );
828-
}
829-
830-
@Override
831-
public Object load(String entityName, Object id, LockOptions lockOptions) {
832-
return delegate.load( entityName, id, lockOptions );
833-
}
834-
835-
@Override
836-
public <T> T load(Class<T> theClass, Object id) {
837-
return delegate.load( theClass, id );
838-
}
839-
840-
@Override
841-
public Object load(String entityName, Object id) {
842-
return delegate.load( entityName, id );
843-
}
844-
845813
@Override
846814
public void load(Object object, Object id) {
847815
delegate.load( object, id );

hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -186,42 +186,6 @@ public void evict(Object object) {
186186
this.lazySession.get().evict( object );
187187
}
188188

189-
@Override
190-
@Deprecated
191-
public <T> T load(Class<T> theClass, Object id, LockMode lockMode) {
192-
return this.lazySession.get().load( theClass, id, lockMode );
193-
}
194-
195-
@Override
196-
@Deprecated
197-
public <T> T load(Class<T> theClass, Object id, LockOptions lockOptions) {
198-
return this.lazySession.get().load( theClass, id, lockOptions );
199-
}
200-
201-
@Override
202-
@Deprecated
203-
public Object load(String entityName, Object id, LockMode lockMode) {
204-
return this.lazySession.get().load( entityName, id, lockMode );
205-
}
206-
207-
@Override
208-
@Deprecated
209-
public Object load(String entityName, Object id, LockOptions lockOptions) {
210-
return this.lazySession.get().load( entityName, id, lockOptions );
211-
}
212-
213-
@Override
214-
@Deprecated
215-
public <T> T load(Class<T> theClass, Object id) {
216-
return this.lazySession.get().load( theClass, id );
217-
}
218-
219-
@Override
220-
@Deprecated
221-
public Object load(String entityName, Object id) {
222-
return this.lazySession.get().load( entityName, id );
223-
}
224-
225189
@Override
226190
public void load(Object object, Object id) {
227191
this.lazySession.get().load( object, id );

hibernate-core/src/main/java/org/hibernate/event/spi/EventSource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ public interface EventSource extends SessionImplementor {
6666
// ordering is improved.
6767
void removeOrphanBeforeUpdates(String entityName, Object child);
6868

69+
Object load(String entityName, Object identifier);
6970
}

hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,6 @@ public ProcedureCall createStoredProcedureQuery(String procedureName, String...
14051405
return procedureCall;
14061406
}
14071407

1408-
protected abstract Object load(String entityName, Object identifier);
1409-
14101408
@Override
14111409
public ExceptionConverter getExceptionConverter() {
14121410
if ( exceptionConverter == null ) {

hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -945,11 +945,6 @@ public void load(Object object, Object id) throws HibernateException {
945945
fireLoad( new LoadEvent( id, object, this, getReadOnlyFromLoadQueryInfluencers() ), LoadEventListener.RELOAD );
946946
}
947947

948-
@Override @Deprecated
949-
public <T> T load(Class<T> entityClass, Object id) throws HibernateException {
950-
return this.byId( entityClass ).getReference( id );
951-
}
952-
953948
@Override @Deprecated
954949
public Object load(String entityName, Object id) throws HibernateException {
955950
return this.byId( entityName ).getReference( id );
@@ -1056,26 +1051,6 @@ private void finishWithEventInstance(LoadEvent event) {
10561051
}
10571052
}
10581053

1059-
@Override @Deprecated
1060-
public <T> T load(Class<T> entityClass, Object id, LockMode lockMode) throws HibernateException {
1061-
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).getReference( id );
1062-
}
1063-
1064-
@Override @Deprecated
1065-
public <T> T load(Class<T> entityClass, Object id, LockOptions lockOptions) throws HibernateException {
1066-
return this.byId( entityClass ).with( lockOptions ).getReference( id );
1067-
}
1068-
1069-
@Override @Deprecated
1070-
public Object load(String entityName, Object id, LockMode lockMode) throws HibernateException {
1071-
return this.byId( entityName ).with( new LockOptions( lockMode ) ).getReference( id );
1072-
}
1073-
1074-
@Override @Deprecated
1075-
public Object load(String entityName, Object id, LockOptions lockOptions) throws HibernateException {
1076-
return this.byId( entityName ).with( lockOptions ).getReference( id );
1077-
}
1078-
10791054
@Override
10801055
public <T> T get(Class<T> entityClass, Object id, LockMode lockMode) throws HibernateException {
10811056
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).load( id );

hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,6 @@ public void setAutoClear(boolean enabled) {
881881
throw new UnsupportedOperationException();
882882
}
883883

884-
@Override
885-
protected Object load(String entityName, Object identifier) {
886-
return null;
887-
}
888-
889884
public boolean isDefaultReadOnly() {
890885
return false;
891886
}

0 commit comments

Comments
 (0)