use of org.hibernate.service.spi.SessionFactoryServiceRegistry in project hibernate-orm by hibernate.
the class ClearEventListenerTest 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.CLEAR, listener);
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
});
}
use of org.hibernate.service.spi.SessionFactoryServiceRegistry in project hibernate-orm by hibernate.
the class LegacyPostCommitListenerTest 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.POST_COMMIT_DELETE).appendListener(postCommitDeleteEventListener);
serviceRegistry.getService(EventListenerRegistry.class).getEventListenerGroup(EventType.POST_COMMIT_UPDATE).appendListener(postCommitUpdateEventListener);
serviceRegistry.getService(EventListenerRegistry.class).getEventListenerGroup(EventType.POST_COMMIT_INSERT).appendListener(postCommitInsertEventListener);
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
});
}
use of org.hibernate.service.spi.SessionFactoryServiceRegistry in project hibernate-orm by hibernate.
the class PostCommitListenerTest 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.POST_COMMIT_DELETE).appendListener(postCommitDeleteEventListener);
serviceRegistry.getService(EventListenerRegistry.class).getEventListenerGroup(EventType.POST_COMMIT_UPDATE).appendListener(postCommitUpdateEventListener);
serviceRegistry.getService(EventListenerRegistry.class).getEventListenerGroup(EventType.POST_COMMIT_INSERT).appendListener(postCommitInsertEventListener);
}
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
});
}
use of org.hibernate.service.spi.SessionFactoryServiceRegistry in project hibernate-orm by hibernate.
the class TestAutoFlushBeforeQueryExecution 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.service.spi.SessionFactoryServiceRegistry 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();
}
});
}
Aggregations