Recent Pos

Value Object or Data Transfer Object (DTO) design pattern


java data transfer object implementation

⇒ This is one of the core design patterns.

⇒ In case we have requirement of transferring the data with multiple details like for example Employee no. , Name, Salary and Dept no. between layers/tiers we find problem in individually transferring them.

⇒ To solve this problem we want to implement an object which host the data to transfer. Such object is known as value object (VO) or Data Transfer Object (DTO).

⇒ When implementing these design patterns in Java we are recommended to consider the following points:

1. Consider for implementing Serializable (This is required only in case if the object is transferred in network).

2. Have no-arg constructor.

3. Implement setXxx and getXxx methods for the fields.

-The following are the conventions as per the Java Bean for set and get methods:


Note: Use the, from previous example.
Download this example:
<-Previous: Working with JDBC ResultSet object | | Next->The JDBC Statement execute() method

No Comments

Post a Comment