Search in sources :

Example 51 with ClassMetadata

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

the class SessionFactoryFacadeTest method testGetClassMetadata.

@Ignore
@Test
public void testGetClassMetadata() {
    Configuration configuration = new Configuration();
    configuration.addClass(Foo.class);
    SessionFactory sessionFactory = configuration.buildSessionFactory();
    ClassMetadata classMetadata = sessionFactory.getClassMetadata(Foo.class);
    ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
    Assert.assertSame(classMetadata, ((IFacade) sessionFactoryFacade.getClassMetadata(Foo.class)).getTarget());
    Assert.assertSame(classMetadata, ((IFacade) sessionFactoryFacade.getClassMetadata("org.jboss.tools.hibernate.runtime.v_3_5.internal.test.Foo")).getTarget());
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) ClassMetadata(org.hibernate.metadata.ClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) Configuration(org.hibernate.cfg.Configuration) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 52 with ClassMetadata

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

the class FacadeFactoryTest method testCreateClassMetadata.

@Test
public void testCreateClassMetadata() {
    ClassMetadata classMetadata = (ClassMetadata) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { ClassMetadata.class }, new TestInvocationHandler());
    IClassMetadata facade = facadeFactory.createClassMetadata(classMetadata);
    Assert.assertSame(classMetadata, ((IFacade) facade).getTarget());
}
Also used : ClassMetadata(org.hibernate.metadata.ClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.Test)

Example 53 with ClassMetadata

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

the class ClassMetadataFacadeTest method setUp.

@Before
public void setUp() {
    ClassMetadata target = (ClassMetadata) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { ClassMetadata.class }, new TestInvocationHandler());
    classMetadata = new ClassMetadataFacadeImpl(FACADE_FACTORY, target) {
    };
}
Also used : ClassMetadata(org.hibernate.metadata.ClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) RootClass(org.hibernate.mapping.RootClass) PersistentClass(org.hibernate.mapping.PersistentClass) Before(org.junit.Before)

Example 54 with ClassMetadata

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

the class FacadeFactoryTest method testCreateClassMetadata.

@Test
public void testCreateClassMetadata() {
    ClassMetadata classMetadata = (ClassMetadata) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { ClassMetadata.class }, new TestInvocationHandler());
    IClassMetadata facade = facadeFactory.createClassMetadata(classMetadata);
    assertTrue(facade instanceof ClassMetadataFacadeImpl);
    assertSame(classMetadata, ((IFacade) facade).getTarget());
}
Also used : ClassMetadata(org.hibernate.metadata.ClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) PersistentClass(org.hibernate.mapping.PersistentClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) Test(org.junit.jupiter.api.Test)

Example 55 with ClassMetadata

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

the class FacadeFactoryTest method testCreateClassMetadata.

@Test
public void testCreateClassMetadata() {
    ClassMetadata classMetadata = (ClassMetadata) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { ClassMetadata.class }, new TestInvocationHandler());
    IClassMetadata facade = facadeFactory.createClassMetadata(classMetadata);
    assertTrue(facade instanceof ClassMetadataFacadeImpl);
    assertSame(classMetadata, ((IFacade) facade).getTarget());
}
Also used : ClassMetadata(org.hibernate.metadata.ClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) IClassMetadata(org.jboss.tools.hibernate.runtime.spi.IClassMetadata) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.internal.export.java.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.jupiter.api.Test)

Aggregations

ClassMetadata (org.hibernate.metadata.ClassMetadata)58 PersistentClass (org.hibernate.mapping.PersistentClass)23 IClassMetadata (org.jboss.tools.hibernate.runtime.spi.IClassMetadata)21 RootClass (org.hibernate.mapping.RootClass)20 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)12 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)12 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)11 Test (org.junit.jupiter.api.Test)11 Type (org.hibernate.type.Type)10 Before (org.junit.Before)8 Field (java.lang.reflect.Field)5 AbstractEntityPersister (org.hibernate.persister.entity.AbstractEntityPersister)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 Session (org.hibernate.Session)4 SessionFactory (org.hibernate.SessionFactory)4 SessionImpl (org.hibernate.internal.SessionImpl)4 ComponentType (org.hibernate.type.ComponentType)4 AbstractClassMetadataFacade (org.jboss.tools.hibernate.runtime.common.AbstractClassMetadataFacade)4 MasterDataEntity (org.mifos.application.master.business.MasterDataEntity)4