Best code examples for Hibernate ORM AnsiTrimEmulationFunction class (org.hibernate.dialect.function.AnsiTrimEmulationFunction)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM AnsiTrimEmulationFunction class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Hibernate ORM AnsiTrimEmulationFunction examples from Open Source projects
This code example shows how to use the following methods: render
 */ 
public class AnsiTrimEmulationFunctionTest extends TestCase {
	private static final String trimSource = "a.column";
 
	public void testBasicSqlServerProcessing() { 
		AnsiTrimEmulationFunction function = new AnsiTrimEmulationFunction();
 
		performBasicSpaceTrimmingTests( function );
 
		final String expectedTrimPrep = "replace(replace(a.column,' ','${space}$'),'-',' ')";
		final String expectedPostTrimPrefix = "replace(replace(";
		final String expectedPostTrimSuffix = ",' ','-'),'${space}$',' ')";
 
		// -> trim(LEADING '-' FROM a.column) 
		String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
		String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
		assertEquals( expected, rendered );
 
		// -> trim(TRAILING '-' FROM a.column) 
		rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );

5
CodeRank