I am trying to use dynamic hibernate model, below is the code snippet to get the session.I have declared "hibernate.default_entity_mode
" as "dynamic_map
" in hibernate session factory config xml.
// Declared at class level
@Autowired
private SessionFactory sessionFactory;
//In specific java-method
Session pojoSession = sessionFactory.getCurrentSession();
Session ds = pojoSession.getSession(EntityMode.MAP);
Still, I get an exception in eclipse saying-"The method getSession(EntityMode) is undefined for the type Session
" on second line, while trying to get dynamicSession from pojoSession.
I am using Hibernate 4.2.6.Final core and entity-manager & spring 3.2 framework jars.
Can anyone assist on what I am doing wrong?
Update: Seems like that method is actually missing from 4.2.6 org.hibernate.Session
class. Also, checked earlier versions 4.2.1, 4.2.3 etc, but don't see any getSession()
method defined for Session class. Not sure if the feature has been removed. Can anyone assist on what is the latest version of hibernate supporting EntityMode.MAP
?
Thanks!