Java Code Examples for org.hibernate.Session.getSessionFactory()

The following are Jave code examples for showing how to use getSessionFactory() of the org.hibernate.Session class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: hibernate-ogm-ignite   File: IgniteTestHelper.java   View Source Code Vote up 6 votes
@Override
public Map<String, Object> extractEntityTuple(Session session, EntityKey key) {
	SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) session.getSessionFactory();
	IgniteCache<Object, BinaryObject> cache = getEntityCache( sessionFactory, key.getMetadata() );
	Object cacheKey = getProvider( sessionFactory ).createKeyObject( key );

	Map<String, Object> result = new HashMap<>();
	BinaryObject po = cache.get( cacheKey );

	TupleSnapshot snapshot = new IgniteTupleSnapshot( cacheKey, po, key.getMetadata() );
	for ( String fieldName : snapshot.getColumnNames() ) {
		result.put( fieldName, snapshot.get( fieldName ) );
	}

	return result;
}
 
Example 2
Project: hibernate-ogm-ignite   File: IgniteTestHelper.java   View Source Code Vote up 4 votes
public static <K> Map<K, BinaryObject> find(Session session, Class<?> class1, @SuppressWarnings("unchecked") K... ids) {
	SessionFactory sessionFactory = session.getSessionFactory();
	return find( sessionFactory, class1, ids );
}