use of org.hibernate.property.access.spi.GetterFieldImpl in project hibernate-orm by hibernate.
the class AccessMappingTest method testDefaultFieldAccessIsInherited.
@Test
public void testDefaultFieldAccessIsInherited() throws Exception {
Configuration cfg = new Configuration();
Class<?> classUnderTest = User.class;
cfg.addAnnotatedClass(classUnderTest);
cfg.addAnnotatedClass(Person.class);
cfg.addAnnotatedClass(Being.class);
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory(serviceRegistry);
try {
EntityTuplizer tuplizer = factory.getEntityPersister(classUnderTest.getName()).getEntityMetamodel().getTuplizer();
assertTrue("Field access should be used since the default access mode gets inherited", tuplizer.getIdentifierGetter() instanceof GetterFieldImpl);
} finally {
factory.close();
}
}
use of org.hibernate.property.access.spi.GetterFieldImpl in project hibernate-orm by hibernate.
the class AccessMappingTest method testExplicitPropertyAccessAnnotationsWithJpaStyleOverride.
@Test
public void testExplicitPropertyAccessAnnotationsWithJpaStyleOverride() throws Exception {
Configuration cfg = new Configuration();
Class<?> classUnderTest = Course5.class;
cfg.addAnnotatedClass(classUnderTest);
cfg.addAnnotatedClass(Student.class);
SessionFactoryImplementor factory = (SessionFactoryImplementor) cfg.buildSessionFactory(serviceRegistry);
try {
EntityTuplizer tuplizer = factory.getEntityPersister(classUnderTest.getName()).getEntityMetamodel().getTuplizer();
assertTrue("Field access should be used.", tuplizer.getIdentifierGetter() instanceof GetterFieldImpl);
assertTrue("Property access should be used.", tuplizer.getGetter(0) instanceof GetterMethodImpl);
} finally {
factory.close();
}
}
Aggregations