FileDocCategorySizeDatePackage
NvlFunction.javaAPI DocHibernate 3.2.51070Fri Apr 29 10:32:30 BST 2005org.hibernate.dialect.function

NvlFunction

public class NvlFunction extends Object implements SQLFunction
Emulation of coalesce() on Oracle, using multiple nvl() calls
author
Gavin King

Fields Summary
Constructors Summary
Methods Summary
public org.hibernate.type.TypegetReturnType(org.hibernate.type.Type columnType, org.hibernate.engine.Mapping mapping)

		return columnType;
	
public booleanhasArguments()

		return true;
	
public booleanhasParenthesesIfNoArguments()

		return true;
	
public java.lang.Stringrender(java.util.List args, org.hibernate.engine.SessionFactoryImplementor factory)

		int lastIndex = args.size()-1;
		Object last = args.remove(lastIndex);
		if ( lastIndex==0 ) return last.toString();
		Object secondLast = args.get(lastIndex-1);
		String nvl = "nvl(" + secondLast + ", " + last + ")";
		args.set(lastIndex-1, nvl);
		return render(args, factory);