use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class TestCollectionInitializingDuringFlush 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).getEventListenerGroup(EventType.PRE_UPDATE).appendListener(InitializingPreUpdateEventListener.INSTANCE);
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
});
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class ClassCommentTest method testClassComment.
@Test
public void testClassComment() {
StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySetting("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
MetadataSources metadataSources = new MetadataSources(serviceRegistryBuilder.build());
metadataSources.addInputStream(new ReaderInputStream(new StringReader(CLASS_COMMENT_HBM_XML)));
Metadata metadata = metadataSources.buildMetadata();
PersistentClass pc = metadata.getEntityBinding("org.hibernate.test.hbm.Foo");
Assert.assertNotNull(pc);
Table table = pc.getTable();
Assert.assertNotNull(table);
Assert.assertEquals("This is class 'Foo' with property 'bar'.", table.getComment());
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class CollectionKeyFkNameTest method verifyFkNameUsed.
private void verifyFkNameUsed(String mappingResource, String expectedName) {
final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
new SchemaCreatorImpl(ssr).doCreation(metadata, ssr, ssr.getService(ConfigurationService.class).getSettings(), false, target);
assertTrue("Expected foreign-key name [" + expectedName + "] not seen in schema creation output", target.containedText(expectedName));
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class IndexTest method verifyIndexCreated.
private void verifyIndexCreated(String mappingResource, String expectedIndexName) {
final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
new SchemaCreatorImpl(ssr).doCreation(metadata, false, target);
assertTrue("Expected index [" + expectedIndexName + "] not seen in schema creation output", target.containedText(expectedIndexName));
}
use of org.hibernate.boot.Metadata in project hibernate-orm by hibernate.
the class EagerKeyManyToOneTest 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).prependListeners(EventType.LOAD, new CustomLoadListener());
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
});
}
Aggregations