[hibernate-dev] Removing deprecated methods from Session and SessionFactory
Gunnar Morling
gunnar at hibernate.org
Tue May 5 03:04:42 EDT 2015
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
More information about the hibernate-dev
mailing list