In the previous posts under “Java Scripting”, we used ScriptEngine eval method to execute scripts stored in a string variable or file. The ScriptEngine’s eval methods takes the script compiles to intermediate code and execute it immediately. If we have a script which has to be executed repeatedly, then instead of compiling and executing it…… Continue reading Executing compiled script
Month: September 2016
Combining Predicates
This post explains how we can combine two or more predicates using logical operations as mentioned below 1) and 2) or 3) negate Below is an example Person package Function; public class Person { private String ssn; private String fname; private String lname; private String description; private int age; public String getSsn() { return ssn;…… Continue reading Combining Predicates
Getting JsonGenerator settings
This post explains how to get JsonGenerator settings. JsonGenerator class obtained from JsonFactory is responsible for writing json data as a stream instead of constructing an entire object model in memory and then writing to destination. The list of settings that can be turned on or off are present in an enumeration JsonGenerator.Feature. The below…… Continue reading Getting JsonGenerator settings
Getting JsonFactory settings
This post explains how to get JsonFactory settings. The JsonFactory class is thread safe and responsible for creating instances of writer and reader. Creating an instance of JsonFactory is an light weight operation. The list of settings that can be turned on or off are present in an enumeration JsonFactory.Feature. The below code shows how…… Continue reading Getting JsonFactory settings
Executing sql statements as a batch through hibernate
They are two ways to execute sql statements as batch in hibernate, which are 1) Work 2) ReturningWork This approach is useful when we want to perform batch operations directly on the database instead of indirectly through hibernate. First we will implement the Work interface as shown below JdbcWork class JdbcWork implements Work { private…… Continue reading Executing sql statements as a batch through hibernate