Search in sources :

Example 16 with MetadataBuildingOptionsImpl

use of org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl in project jbosstools-hibernate by jbosstools.

the class ClassMetadataFacadeTest method setupFooBarPersister.

private ClassMetadata setupFooBarPersister() {
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, TestDialect.class.getName());
    StandardServiceRegistry serviceRegistry = ssrb.build();
    MetadataBuildingOptionsImpl metadataBuildingOptions = new MetadataBuildingOptionsImpl(serviceRegistry);
    InFlightMetadataCollector inFlightMetadataCollector = new InFlightMetadataCollectorImpl(metadataBuildingOptions, new TypeResolver());
    ClassLoaderService classLoaderService = metadataBuildingOptions.getServiceRegistry().getService(ClassLoaderService.class);
    ClassLoaderAccess classLoaderAccess = new ClassLoaderAccessImpl(metadataBuildingOptions.getTempClassLoader(), classLoaderService);
    MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl(metadataBuildingOptions, classLoaderAccess, inFlightMetadataCollector);
    MetadataImplementor metadataImplementor = (MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
    return new TestEntityPersister(createPersistentClass(metadataBuildingContext, metadataImplementor), new TestCreationContext(metadataImplementor));
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) TypeResolver(org.hibernate.type.TypeResolver) MetadataBuildingOptionsImpl(org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl) MetadataSources(org.hibernate.boot.MetadataSources) ClassLoaderAccessImpl(org.hibernate.boot.internal.ClassLoaderAccessImpl) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) ClassLoaderAccess(org.hibernate.boot.spi.ClassLoaderAccess) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService)

Example 17 with MetadataBuildingOptionsImpl

use of org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl in project jbosstools-hibernate by jbosstools.

the class ClassMetadataFacadeTest method setupFooBarPersister.

private ClassMetadata setupFooBarPersister() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    builder.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry serviceRegistry = builder.build();
    MetadataBuildingOptionsImpl metadataBuildingOptions = new MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContextImpl bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    metadataBuildingOptions.setBootstrapContext(bootstrapContext);
    InFlightMetadataCollector inFlightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl("JBoss Tools", bootstrapContext, metadataBuildingOptions, inFlightMetadataCollector);
    AbstractEntityPersister result = new TestEntityPersister(createPersistentClass(metadataBuildingContext), createPersisterCreationContext(serviceRegistry, bootstrapContext));
    return result;
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockConnectionProvider) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) MetadataBuildingOptionsImpl(org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl) MockDialect(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockDialect) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry)

Example 18 with MetadataBuildingOptionsImpl

use of org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl in project jbosstools-hibernate by jbosstools.

the class EntityMetamodelFacadeTest method createFooBarModel.

private EntityMetamodel createFooBarModel() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    StandardServiceRegistry serviceRegistry = builder.build();
    MetadataBuildingOptionsImpl metadataBuildingOptions = new MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContextImpl bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    metadataBuildingOptions.setBootstrapContext(bootstrapContext);
    InFlightMetadataCollector inFlightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl(bootstrapContext, metadataBuildingOptions, inFlightMetadataCollector);
    PersistentClass persistentClass = createPersistentClass(metadataBuildingContext);
    MetadataSources metadataSources = new MetadataSources(serviceRegistry);
    SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) metadataSources.buildMetadata().buildSessionFactory();
    return new EntityMetamodel(persistentClass, null, sessionFactoryImplementor) {

        private static final long serialVersionUID = 1L;

        @Override
        public EntityTuplizer getTuplizer() {
            return (EntityTuplizer) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { EntityTuplizer.class }, new TestInvocationHandler());
        }

        @Override
        public Integer getPropertyIndexOrNull(String id) {
            methodName = "getPropertyIndexOrNull";
            arguments = new Object[] { id };
            return INDEX;
        }
    };
}
Also used : EntityTuplizer(org.hibernate.tuple.entity.EntityTuplizer) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) MetadataBuildingOptionsImpl(org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl) MockDialect(org.jboss.tools.hibernate.runtime.v_5_3.internal.util.MockDialect) MetadataSources(org.hibernate.boot.MetadataSources) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) RootClass(org.hibernate.mapping.RootClass) PersistentClass(org.hibernate.mapping.PersistentClass) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) IEntityMetamodel(org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) PersistentClass(org.hibernate.mapping.PersistentClass)

Example 19 with MetadataBuildingOptionsImpl

use of org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl in project jbosstools-hibernate by jbosstools.

the class EntityMetamodelFacadeTest method createFooBarModel.

private EntityMetamodel createFooBarModel() {
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, TestDialect.class.getName());
    StandardServiceRegistry serviceRegistry = ssrb.build();
    MetadataBuildingOptionsImpl metadataBuildingOptions = new MetadataBuildingOptionsImpl(serviceRegistry);
    InFlightMetadataCollector inFlightMetadataCollector = new InFlightMetadataCollectorImpl(metadataBuildingOptions, new TypeResolver());
    ClassLoaderService classLoaderService = metadataBuildingOptions.getServiceRegistry().getService(ClassLoaderService.class);
    ClassLoaderAccess classLoaderAccess = new ClassLoaderAccessImpl(metadataBuildingOptions.getTempClassLoader(), classLoaderService);
    MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl(metadataBuildingOptions, classLoaderAccess, inFlightMetadataCollector);
    MetadataSources metadataSources = new MetadataSources(serviceRegistry);
    PersistentClass persistentClass = createPersistentClass(metadataBuildingContext, (MetadataImplementor) metadataSources.buildMetadata());
    SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) metadataSources.buildMetadata().buildSessionFactory();
    return new EntityMetamodel(persistentClass, null, sessionFactoryImplementor) {

        private static final long serialVersionUID = 1L;

        @Override
        public EntityTuplizer getTuplizer() {
            return (EntityTuplizer) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { EntityTuplizer.class }, new TestInvocationHandler());
        }

        @Override
        public Integer getPropertyIndexOrNull(String id) {
            methodName = "getPropertyIndexOrNull";
            arguments = new Object[] { id };
            return INDEX;
        }
    };
}
Also used : EntityTuplizer(org.hibernate.tuple.entity.EntityTuplizer) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) TypeResolver(org.hibernate.type.TypeResolver) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) MetadataBuildingOptionsImpl(org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl) MetadataSources(org.hibernate.boot.MetadataSources) ClassLoaderAccessImpl(org.hibernate.boot.internal.ClassLoaderAccessImpl) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) ClassLoaderAccess(org.hibernate.boot.spi.ClassLoaderAccess) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) RootClass(org.hibernate.mapping.RootClass) PersistentClass(org.hibernate.mapping.PersistentClass) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) IEntityMetamodel(org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService) PersistentClass(org.hibernate.mapping.PersistentClass)

Example 20 with MetadataBuildingOptionsImpl

use of org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl in project jbosstools-hibernate by jbosstools.

the class ClassMetadataFacadeTest method setupFooBarPersister.

private ClassMetadata setupFooBarPersister() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    builder.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    builder.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry serviceRegistry = builder.build();
    MetadataBuildingOptionsImpl metadataBuildingOptions = new MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContextImpl bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    metadataBuildingOptions.setBootstrapContext(bootstrapContext);
    InFlightMetadataCollector inFlightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl(bootstrapContext, metadataBuildingOptions, inFlightMetadataCollector);
    AbstractEntityPersister result = new TestEntityPersister(createPersistentClass(metadataBuildingContext), createPersisterCreationContext(serviceRegistry, bootstrapContext));
    return result;
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_5_6.internal.util.MockConnectionProvider) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) MetadataBuildingOptionsImpl(org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl) MockDialect(org.jboss.tools.hibernate.runtime.v_5_6.internal.util.MockDialect) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry)

Aggregations

InFlightMetadataCollectorImpl (org.hibernate.boot.internal.InFlightMetadataCollectorImpl)24 MetadataBuildingOptionsImpl (org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl)24 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)24 MetadataBuildingContextRootImpl (org.hibernate.boot.internal.MetadataBuildingContextRootImpl)21 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)21 InFlightMetadataCollector (org.hibernate.boot.spi.InFlightMetadataCollector)20 MetadataBuildingContext (org.hibernate.boot.spi.MetadataBuildingContext)16 BootstrapContextImpl (org.hibernate.boot.internal.BootstrapContextImpl)15 TypeResolver (org.hibernate.type.TypeResolver)9 MetadataSources (org.hibernate.boot.MetadataSources)8 PersistentClass (org.hibernate.mapping.PersistentClass)7 RootClass (org.hibernate.mapping.RootClass)7 EntityMetamodel (org.hibernate.tuple.entity.EntityMetamodel)7 EntityTuplizer (org.hibernate.tuple.entity.EntityTuplizer)7 IEntityMetamodel (org.jboss.tools.hibernate.runtime.spi.IEntityMetamodel)7 ClassLoaderAccessImpl (org.hibernate.boot.internal.ClassLoaderAccessImpl)6 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)6 ClassLoaderAccess (org.hibernate.boot.spi.ClassLoaderAccess)6 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)5 AbstractEntityPersister (org.hibernate.persister.entity.AbstractEntityPersister)5