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

This code example shows how to use the following methods:getType, isSimpleValue
 
	protected Object handle(Value o) {
		Value value = (Value) o;
		try { 
			// have to attempt calling gettype to decide if its custom type. 
			Type type = value.getType();
			if(type instanceof CustomType || type instanceof CompositeCustomType) {
				return toName( type.getReturnedClass() );
			} 
		} catch(HibernateException he) {
			// ignore 
		} 
 
		if ( preferRawTypeNames && value.isSimpleValue() ) {
			// this logic make us use the raw typename if it is something else than an Hibernate type. So, if user wrote long we will use long...if he meant to have a Long then he should use the java.lang.Long version. 
			String typename = ( (SimpleValue) value ).getTypeName();
			if ( !Cfg2JavaTool.isNonPrimitiveTypeName( typename ) ) {
				String val = ( (SimpleValue) value ).getTypeName();
				if(val!=null) return val; // val can be null when type is any 
			} 

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:getComparatorClassName, isSorted, accept
		if(c2j.getJavaTypeName(p, false)==null) {
			throw new IllegalArgumentException();
		} else if (p.getValue() instanceof Collection) {
			Collection col = (Collection) p.getValue();
			 
			DefaultInitializor initialization = (DefaultInitializor) col.accept(new DefaultValueVisitor(true) {
			  
				public Object accept(Bag o) {
					return new DefaultInitializor("java.util.ArrayList", true); 
				} 
				 
				public Object accept(org.hibernate.mapping.List o) {
					return new DefaultInitializor("java.util.ArrayList", true); 
				} 
				 
				public Object accept(org.hibernate.mapping.Map o) {
					if(o.isSorted()) {
						return new DefaultInitializor("java.util.TreeMap", false); 
					} else { 
						return new DefaultInitializor("java.util.HashMap", true); 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java