类org.hibernate.type.DiscriminatorType源码实例Demo

下面列出了怎么用org.hibernate.type.DiscriminatorType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cacheonix-core   文件: HbmBinder.java
public static void bindAny(Element node, Any any, boolean isNullable, Mappings mappings)
		throws MappingException {
	any.setIdentifierType( getTypeFromXML( node ) );
	Attribute metaAttribute = node.attribute( "meta-type" );
	if ( metaAttribute != null ) {
		any.setMetaType( metaAttribute.getValue() );

		Iterator iter = node.elementIterator( "meta-value" );
		if ( iter.hasNext() ) {
			HashMap values = new HashMap();
			org.hibernate.type.Type metaType = TypeFactory.heuristicType( any.getMetaType() );
			while ( iter.hasNext() ) {
				Element metaValue = (Element) iter.next();
				try {
					Object value = ( (DiscriminatorType) metaType ).stringToObject( metaValue
						.attributeValue( "value" ) );
					String entityName = getClassName( metaValue.attribute( "class" ), mappings );
					values.put( value, entityName );
				}
				catch (ClassCastException cce) {
					throw new MappingException( "meta-type was not a DiscriminatorType: "
						+ metaType.getName() );
				}
				catch (Exception e) {
					throw new MappingException( "could not interpret meta-value", e );
				}
			}
			any.setMetaValues( values );
		}

	}

	bindColumns( node, any, isNullable, false, null, mappings );
}
 
 类所在包
 类方法
 同包方法