Hibernate ORM RootClass - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM RootClass class.

This code example shows how to use the following methods: setClassName, setMetaAttributes
		assertEquals( "should be interface which cannot have implements", null, 
				entityPOJOClass.getImplements() );
		assertEquals( "should be interface which cannot have implements", "", 
				entityPOJOClass.getImplementsDeclaration() );
 
		PersistentClass base = new RootClass();
		base.setClassName( "Base" );
 
		PersistentClass sub = new SingleTableSubclass( base );
		sub.setClassName( "Sub" );
 
		assertEquals( null, c2j.getPOJOClass(base).getExtends() );
		assertEquals( "Base", c2j.getPOJOClass(sub).getExtends() );
 
		Map m = new HashMap();
		MetaAttribute attribute = new MetaAttribute( "extends" );
		attribute.addValue( "x" );
		attribute.addValue( "y" );
		m.put( attribute.getName(), attribute );
		attribute = new MetaAttribute( "interface" );

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setIdentifierProperty
        Session session = mockSession();
        Logger logger = mockLogger(); 
 
        replay(); 
 
        RootClass persistentClass = new RootClass();
        Property idProperty = new Property();
        idProperty.setName("id");
        persistentClass.setIdentifierProperty(idProperty);
        SampleEntity entity = new SampleEntity();
 
        HibernateEntityValueEncoder<SampleEntity> encoder = new HibernateEntityValueEncoder<SampleEntity>(
                SampleEntity.class, persistentClass, session, access, typeCoercer, logger);
 
        assertNull(encoder.toClient(entity));
 
        verify(); 
    } 
 
    @Test
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 */ 
public class Cfg2HbmToolTest extends TestCase {
	 
	public void testNeedsTable(){ 
		Cfg2HbmTool c2h = new Cfg2HbmTool();
		PersistentClass pc = new RootClass();
		assertTrue(c2h.needsTable(pc));
		assertTrue(c2h.needsTable(new JoinedSubclass(pc)));
		assertTrue(c2h.needsTable(new UnionSubclass(pc)));
		assertFalse(c2h.needsTable(new SingleTableSubclass(pc)));
		assertFalse(c2h.needsTable(new Subclass(pc)));
				 
	} 
	 
	public static Test suite() {
		return new TestSuite(Cfg2HbmToolTest.class);
	} 
	 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: isDiscriminatorInsertable, isForceDiscriminator
		PersistentClass persistentClass = configuration.getClassMapping( BaseClass.class.getName() );
		assertNotNull( persistentClass );
		assertTrue( persistentClass instanceof RootClass );
 
		RootClass root = ( RootClass ) persistentClass;
		assertTrue( "Discriminator should be forced", root.isForceDiscriminator() );
		assertFalse( "Discriminator should not be insertable", root.isDiscriminatorInsertable() );
	} 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
				.isEqualTo( SingleTableOgmEntityPersister.class ); 
	} 
 
	@Test
	public void testPersistentRootSingleTableStrategy() throws Exception {
		RootClass rootClass = new RootClass();
		assertThat( resolver.getEntityPersisterClass( rootClass ) ).isEqualTo( SingleTableOgmEntityPersister.class );
	} 
 
	@Test
	public void testSinglePersistentClassTableStrategy() throws Exception {
		Subclass subclass = new SingleTableSubclass( new RootClass() );
		assertThat( resolver.getEntityPersisterClass( subclass ) ).isEqualTo( SingleTableOgmEntityPersister.class );
	} 
 
	@Test
	public void testTablePerClassPersistentSubclassStrategy() throws Exception {
		Subclass subclass = new UnionSubclass( new RootClass() );
		assertThat( resolver.getEntityPersisterClass( subclass ) ).isEqualTo( UnionSubclassOgmEntityPersister.class );
	} 
Full Snippet Info
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getClassName, getTable
    /** 
     * Build the root class. 
     */ 
    private void createTableRule( RootClass mapping )
    { 
        addTableRule( mapping.getTable().getName(), mapping.getClassName() );
    } 
 
    /** 
     * Add query cache region. 
     */ 
    private void addQueryCacheRegion( NamedQueryDefinition mapping )
    { 
        String cacheRegion = mapping.getCacheRegion();
        if ( cacheRegion != null )
        { 
            this.rules.addQueryCacheRegion( cacheRegion );
        } 
    } 
 
Full Snippet Info
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java