Search in sources :

Example 21 with CollectionMetadata

use of org.hibernate.metadata.CollectionMetadata in project jbosstools-hibernate by jbosstools.

the class CollectionMetadataFacadeTest method setUp.

@Before
public void setUp() {
    CollectionMetadata target = (CollectionMetadata) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { CollectionMetadata.class }, new TestInvocationHandler());
    collectionMetadata = new AbstractCollectionMetadataFacade(FACADE_FACTORY, target) {
    };
}
Also used : CollectionMetadata(org.hibernate.metadata.CollectionMetadata) ICollectionMetadata(org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata) AbstractCollectionMetadataFacade(org.jboss.tools.hibernate.runtime.common.AbstractCollectionMetadataFacade) Before(org.junit.Before)

Example 22 with CollectionMetadata

use of org.hibernate.metadata.CollectionMetadata in project jbosstools-hibernate by jbosstools.

the class CollectionMetadataFacadeTest method setUp.

@Before
public void setUp() {
    CollectionMetadata target = (CollectionMetadata) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { CollectionMetadata.class }, new TestInvocationHandler());
    collectionMetadata = new AbstractCollectionMetadataFacade(FACADE_FACTORY, target) {
    };
}
Also used : CollectionMetadata(org.hibernate.metadata.CollectionMetadata) ICollectionMetadata(org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata) AbstractCollectionMetadataFacade(org.jboss.tools.hibernate.runtime.common.AbstractCollectionMetadataFacade) Before(org.junit.Before)

Example 23 with CollectionMetadata

use of org.hibernate.metadata.CollectionMetadata in project jbosstools-hibernate by jbosstools.

the class SessionFactoryFacadeTest method testGetCollectionMetadata.

@Test
public void testGetCollectionMetadata() {
    Configuration configuration = new Configuration();
    configuration.addClass(Foo.class);
    SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
    ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
    CollectionMetadata collectionMetadata = sessionFactory.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_5_1.internal.test.Foo.bars");
    Assert.assertSame(collectionMetadata, ((IFacade) sessionFactoryFacade.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_5_1.internal.test.Foo.bars")).getTarget());
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) CollectionMetadata(org.hibernate.metadata.CollectionMetadata) ICollectionMetadata(org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata) Configuration(org.hibernate.cfg.Configuration) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) Test(org.junit.Test)

Example 24 with CollectionMetadata

use of org.hibernate.metadata.CollectionMetadata in project jbosstools-hibernate by jbosstools.

the class SessionFactoryFacadeTest method testGetCollectionMetadata.

@Test
public void testGetCollectionMetadata() {
    Configuration configuration = new Configuration();
    configuration.addClass(Foo.class);
    SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
    ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
    Metamodel metamodel = ((EntityManagerFactory) sessionFactory).getMetamodel();
    CollectionMetadata collectionMetadata = (CollectionMetadata) ((MetamodelImplementor) metamodel).collectionPersister("org.jboss.tools.hibernate.runtime.v_5_3.internal.test.Foo.bars");
    Assert.assertSame(collectionMetadata, ((IFacade) sessionFactoryFacade.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_5_3.internal.test.Foo.bars")).getTarget());
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) CollectionMetadata(org.hibernate.metadata.CollectionMetadata) ICollectionMetadata(org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata) Configuration(org.hibernate.cfg.Configuration) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) EntityManagerFactory(javax.persistence.EntityManagerFactory) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) Metamodel(javax.persistence.metamodel.Metamodel) Test(org.junit.Test)

Aggregations

CollectionMetadata (org.hibernate.metadata.CollectionMetadata)24 ICollectionMetadata (org.jboss.tools.hibernate.runtime.spi.ICollectionMetadata)24 Test (org.junit.Test)16 SessionFactory (org.hibernate.SessionFactory)8 Configuration (org.hibernate.cfg.Configuration)8 PersistentClass (org.hibernate.mapping.PersistentClass)8 RootClass (org.hibernate.mapping.RootClass)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 AbstractCollectionMetadataFacade (org.jboss.tools.hibernate.runtime.common.AbstractCollectionMetadataFacade)8 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)8 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)8 ISessionFactory (org.jboss.tools.hibernate.runtime.spi.ISessionFactory)8 Before (org.junit.Before)8 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)5 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 Metamodel (javax.persistence.metamodel.Metamodel)2 ServiceRegistry (org.hibernate.service.ServiceRegistry)1 ServiceRegistryBuilder (org.hibernate.service.ServiceRegistryBuilder)1