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

This code example shows how to use the following methods: getIdentifierProperty, getProperty, getPropertyClosureSpan
		assertEquals(3, project.getPropertyClosureSpan());		
		assertEquals("projectId", project.getIdentifierProperty().getName());
		 
		PersistentClass employee = localCfg.getClassMapping("Employee");
		 
		assertNotNull(employee.getProperty("worksOns"));
		assertNotNull("property should be renamed by reveng.xml", employee.getProperty("manager"));		
		assertPropertyNotExists( employee, "employees", "set should be excluded by reveng.xml" );
		Property setProperty = employee.getProperty("managedProjects");
		assertNotNull("should be renamed by reveng.xml", setProperty);
		 
		assertEquals("delete, update", setProperty.getCascade());
		 
		assertEquals(4, employee.getPropertyClosureSpan());
		assertEquals("id", employee.getIdentifierProperty().getName());
		 
		PersistentClass worksOn = localCfg.getClassMapping("WorksOn");
		 
		assertNotNull(worksOn.getProperty("project"));
		assertNotNull(worksOn.getProperty("employee"));

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getEntityName, getNodeName
		this.nodeName = entityName;
		this.entityName = entityName.substring(index+1);
	} 
 
	public void postInstantiate(PersistentClass pc) {
		this.nodeName =pc.getNodeName();
		this.entityName =pc.getEntityName();
	} 
 
	public HibernateProxy getProxy(final Serializable id,  final SessionImplementor session) {
		try { 
			return new CFCHibernateProxy(new CFCLazyInitializer(entityName, id, session));
		} 
		catch(Throwable t){
			return new CFCHibernateProxy(new CFCLazyInitializer(nodeName, id, session));
		} 
	} 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getIdentifier, getIdentifierProperty, getMappedClass, hasEmbeddedIdentifier, hasIdentifierMapper
				getConstructor(mappedEntity)
			); 
 
		if ( property == null ) {
			// this is a virtual id property... 
			return new IdentifierProperty(
			        type,
					mappedEntity.hasEmbeddedIdentifier(),
					mappedEntity.hasIdentifierMapper(),
					unsavedValue,
					generator
				); 
		} 
		else { 
			return new IdentifierProperty(
					property.getName(),
					property.getNodeName(),
					type,
					mappedEntity.hasEmbeddedIdentifier(),
					unsavedValue,

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMetaAttribute, getProperty
 
	@Test
	@TestForIssue( jiraKey = "HBX-718" ) 
	public void testNonMutatedInheritance() { 
		PersistentClass cm = cfg.getClassMapping("org.hibernate.test.legacy.Wicked");
		MetaAttribute metaAttribute = cm.getMetaAttribute( "globalmutated" );
		 
		assertNotNull(metaAttribute);
		/*assertEquals( metaAttribute.getValues().size(), 2 );		 
		assertEquals( "top level", metaAttribute.getValues().get(0) );*/ 
		assertEquals( "wicked level", metaAttribute.getValue() );
		 
		Property property = cm.getProperty( "component" );
		MetaAttribute propertyAttribute = property.getMetaAttribute( "globalmutated" );
		 
		assertNotNull(propertyAttribute);
		/*assertEquals( propertyAttribute.getValues().size(), 3 ); 
		assertEquals( "top level", propertyAttribute.getValues().get(0) ); 
		assertEquals( "wicked level", propertyAttribute.getValues().get(1) );*/ 
		assertEquals( "monetaryamount level", propertyAttribute.getValue() );

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE