public void initFrom ( SessionFactory sessionFactory ) { Assert . notNull ( sessionFactory ) ; Stopwatch watch = new Stopwatch ( ) . start ( ) ; Map < String , ClassMetadata > classMetadatas = sessionFactory . getAllClassMetadata ( ) ; int entityCount = entityTypes . size ( ) ; int collectionCount = collectionTypes . size ( ) ; for ( Iterator < ClassMetadata > iter = classMetadatas . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { ClassMetadata cm = ( ClassMetadata ) iter . next ( ) ; buildEntityType ( sessionFactory , cm . getEntityName ( ) ) ; } logger . info ( "Find {} entities,{} collections from hibernate in {}" , new Object [ ] { entityTypes . size ( ) - entityCount , collectionTypes . size ( ) - collectionCount , watch } ) ; if ( logger . isDebugEnabled ( ) ) loggerTypeInfo ( ) ; collectionTypes . clear ( ) ; }
Build context from session factory