In regards to the first 2 sets, yes I agree. In regards to your second point, see the discussion on https://hibernate.atlassian.net/browse/HHH-9761 first. One idea was to keep those methods as an "untyped API". Another option would be to add another byId (etc) method for untyped operations, something like:
User user = (User) session.byIdUntyped( UserImpl.class )...load( id ); versus User user = session.byId( User.class )...load( id ); On Tue, May 5, 2015 at 2:04 AM, Gunnar Morling <gun...@hibernate.org> wrote: > Hi, > > There are several deprecated methods on Session: > > * public Object load(Class theClass, Serializable id, LockMode lockMode) > * public Object load(String entityName, Serializable id, LockMode > lockMode); > * public void lock(Object object, LockMode lockMode); > * public void lock(String entityName, Object object, LockMode lockMode); > * public void refresh(Object object, LockMode lockMode); > * public Object get(Class clazz, Serializable id, LockMode lockMode); > * public Object get(String entityName, Serializable id, LockMode lockMode); > > and SessionFactory: > > * public void evict(Class persistentClass) throws HibernateException; > * public void evict(Class persistentClass, Serializable id) throws > HibernateException; > * public void evictEntity(String entityName) throws HibernateException; > * public void evictEntity(String entityName, Serializable id) throws > HibernateException; > * public void evictCollection(String roleName) throws HibernateException; > * public void evictCollection(String roleName, Serializable id) throws > HibernateException; > * public void evictQueries(String cacheRegion) throws HibernateException; > * public void evictQueries() throws HibernateException; > > The docs point to methods to be used alternatively, so the upcoming ORM 5 > major release seems like a good occasion to remove these methods and > simplifying these contracts a bit. Any thoughts? > > On a related note, I am wondering whether > > Session#public Object get(Class clazz, Serializable id, LockOptions > lockOptions); > > etc. pull their weight. The same could be achieved via > > byId( entityClass ).with( lockOptions ).load( id ) > > Is it actually worth to have these "shortcut" methods? > > --Gunnar > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev