use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class ExtendsTest method testEntityNamesWithPackage.
@Test
public void testEntityNamesWithPackage() {
Metadata metadata = new MetadataSources(serviceRegistry).addResource(getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml").buildMetadata();
assertNotNull(metadata.getEntityBinding("EntityHasName"));
assertNotNull(metadata.getEntityBinding("EntityCompany"));
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class CallbackTest method prepareBootstrapRegistryBuilder.
@Override
protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) {
super.prepareBootstrapRegistryBuilder(builder);
builder.applyIntegrator(new Integrator() {
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
integrate(serviceRegistry);
}
private void integrate(SessionFactoryServiceRegistry serviceRegistry) {
serviceRegistry.getService(EventListenerRegistry.class).setListeners(EventType.DELETE, listener);
listener.initialize();
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
listener.cleanup();
}
});
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class GetAndIsVariantGetterTest method testAnnotationsCorrected.
@Test
@TestForIssue(jiraKey = "HHH-10242")
public void testAnnotationsCorrected() {
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(TheEntity2.class).buildMetadata();
assertNotNull(metadata.getEntityBinding(TheEntity2.class.getName()).getIdentifier());
assertNotNull(metadata.getEntityBinding(TheEntity2.class.getName()).getIdentifierProperty());
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class DiscriminatorOptionsTest method testNonDefaultOptions.
@Test
public void testNonDefaultOptions() throws Exception {
final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(BaseClass.class).addAnnotatedClass(SubClass.class).buildMetadata();
PersistentClass persistentClass = metadata.getEntityBinding(BaseClass.class.getName());
assertNotNull(persistentClass);
assertTrue(persistentClass instanceof RootClass);
RootClass root = (RootClass) persistentClass;
assertTrue("Discriminator should be forced", root.isForceDiscriminator());
assertFalse("Discriminator should not be insertable", root.isDiscriminatorInsertable());
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class DiscriminatorOptionsTest method testBaseline.
@Test
public void testBaseline() throws Exception {
final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(BaseClass2.class).addAnnotatedClass(SubClass2.class).buildMetadata();
PersistentClass persistentClass = metadata.getEntityBinding(BaseClass2.class.getName());
assertNotNull(persistentClass);
assertTrue(persistentClass instanceof RootClass);
RootClass root = (RootClass) persistentClass;
assertFalse("Discriminator should not be forced by default", root.isForceDiscriminator());
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
Aggregations