Hibernate ORM SingleTableSubclass - 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 SingleTableSubclass class.

This code example shows how to use the following methods:setClassName, setMetaAttributes
				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" );
		attribute.addValue( "true" );
		m.put( attribute.getName(), attribute );
 

6
CodeRank
This code example shows how to use the following methods:
		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);
	} 
	 
} 
6
CodeRank
This code example shows how to use the following methods:
		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 );
	} 
 
	@Test(expected = UnsupportedOperationException.class)
	public void testPersistenceClassSubclassJoinedStrategy() throws Exception {
		Subclass subclass = new JoinedSubclass( new RootClass() );
		resolver.getEntityPersisterClass( subclass );
	} 
4
CodeRank