cfg.addAnnotatedClass( Animal.class );
SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
EntityMetamodel metaModel = factory.getEntityPersister( Animal.class.getName() )
.getEntityMetamodel();
PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
assertTrue(
"Property access should be used since explicity configured via @Access",
tuplizer.getIdentifierGetter() instanceof BasicPropertyAccessor.BasicGetter
);
metaModel = factory.getEntityPersister( Horse.class.getName() )
.getEntityMetamodel();
tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
assertTrue(
"Property access should be used since the default access mode gets inherited",
tuplizer.getGetter( 0 ) instanceof BasicPropertyAccessor.BasicGetter
);
}