In this post under Gson. I will show how to serialize a java object to JSON using Gson framework. Below is the complete code. Main Code 1 import java.io.File; 2 import java.io.FileWriter; 3 import java.io.IOException; 4 5 import com.google.gson.Gson; 6 7 public class GsonDemo1 { 8 public static void main(String[] args) { 9 Employee employee…… Continue reading Serializing Java objects to JSON
Month: June 2019
Validating Items using ValidatingItemProcessor
In this post under Spring Batch, I will introduce ValidatingItemProcessor and explain how to use it with an example. ValidatingItemProcessor is a implementation of org.springframework.batch.item.ItemProcessor interface. As mentioned in my previous posts, implementation of ItemProcessor is used to place business logic. The implementation of ItemProcessor which contains the business logic is placed between the reader…… Continue reading Validating Items using ValidatingItemProcessor
Unidirectional Many to Many association mapping (without annotations)
In this post under Hibernate, I will explain how to create a unidirectional many to many association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `doctor1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL DEFAULT ‘0’, `description`…… Continue reading Unidirectional Many to Many association mapping (without annotations)
Bidirectional One to One association mapping (without annotations)
In this post under Hibernate, I will explain how to create a bidirectional one to one association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `ticket2` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `number` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Bidirectional One to One association mapping (without annotations)
Unidirectional One to One association mapping (without annotations)
In this post under Hibernate, I will explain how to create a unidirectional one to one association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `ticket1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `number` VARCHAR(50) NOT NULL, `description` VARCHAR(100) NOT…… Continue reading Unidirectional One to One association mapping (without annotations)