-
Mapping (RESOURCE) not found
IDEA in, Entity of xml should be placed resources folder, and hibernate.cfg.xml corresponding mapping-resource modification
-
No CurrentSessionContext configured
Use getCurrentSession when
- session = sessionFactory.openSession();
- In hibernate.cfg.xml add profile
<property name="hibernate.current_session_context_class">thread</property>
-
Calling method 'get' is not valid without an active transaction
Use getCurrentSession when
hibernate requires that all operations on the database must be open transaction management
transaction = session.beginTransaction();
try{
Operation ;
transcation.commit();
}catch( Exception e){
transcation.rollback();
}
-
failed to lazily initialize a collection of role
When many mapping, the default lazy loading
Modify loading:
In the collection mapping at the mapping file, add the lazy properties
Optional values:
false : no delay in loading, disposable loading all values
to true : ( default ) delay loading, load (can not be invoked when a specific entity size )
Extra : automatic, load only the required information