org.hibernate.mapping.PersistentClass#setIdentifierMapper ( )源码实例Demo

下面列出了org.hibernate.mapping.PersistentClass#setIdentifierMapper ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cacheonix-core   文件: HbmBinder.java
public static void bindCompositeId(Element node, Component component,
		PersistentClass persistentClass, String propertyName, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {

	component.setKey( true );

	String path = StringHelper.qualify(
			persistentClass.getEntityName(),
			propertyName == null ? "id" : propertyName );

	bindComponent(
			node,
			component,
			persistentClass.getClassName(),
			propertyName,
			path,
			false,
			node.attribute( "class" ) == null
					&& propertyName == null,
			mappings,
			inheritedMetas,
			false
		);

	if ( "true".equals( node.attributeValue("mapped") ) ) {
		if ( propertyName!=null ) {
			throw new MappingException("cannot combine mapped=\"true\" with specified name");
		}
		Component mapper = new Component(persistentClass);
		bindComponent(
				node,
				mapper,
				persistentClass.getClassName(),
				null,
				path,
				false,
				true,
				mappings,
				inheritedMetas,
				true
			);
		persistentClass.setIdentifierMapper(mapper);
		Property property = new Property();
		property.setName("_identifierMapper");
		property.setNodeName("id");
		property.setUpdateable(false);
		property.setInsertable(false);
		property.setValue(mapper);
		property.setPropertyAccessorName( "embedded" );
		persistentClass.addProperty(property);
	}

}