Here you can find the source of formatEJBQLObjectRestriction(final String fieldName, final Object value, final String paramName, List
public static String formatEJBQLObjectRestriction(final String fieldName, final Object value, final String paramName, List<String> paramsName, List<Object> paramsValue, boolean firstRestriction)
//package com.java2s; /*//from w w w . jav a2 s . c o m * DatabaseUtils.java * * Copyright (c) 1998 - 2006 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium ERP system. * */ import java.util.List; public class Main { public static String formatEJBQLObjectRestriction(final String fieldName, final Object value, final String paramName, List<String> paramsName, List<Object> paramsValue, boolean firstRestriction) { String result = ""; if (value != null) { result = String.format("(%s = :%s)", fieldName, paramName); paramsName.add(paramName); paramsValue.add(value); result = generateRestrictionPrefix(result, firstRestriction); } return result; } private static String generateRestrictionPrefix(final String restrictionText, boolean firstRestriction) { if (!firstRestriction) return " and ".concat(restrictionText); else return restrictionText; } }