Category Archives: Spring

Spring Framework, Spring Security, Spring Web Service, Spring HATEOSA, Spring ActiveMQ

Creating a URL Shortener with Spring RESTful Web Service, Liquibase, and Postgresql

In this note I will create a URL shortening service using Spring Restful, Spring Boot, Liquibase, and PostgreSQL database.  In a similar way of some shortening services, such as,, and, purpose of the shortened URL may be more convenience for website and provide detailed information on clicks a link receives. 1. URL Shortener Service. The service will… Read More »

Liquibase notes

1. Generate Change Logs from an existing database Generate change logs from an existing database. For instance, copy postgresSQL driver to %LINQUIBASE_HOME%/postgresql-8.3-603.jdbc3.jar. Run a following line command in console (single line). If successful, liquibase will show a message “Liquibase ‘generateChangeLog’ Successful” 2. Check a table already presents Using preCondition tag which follows some form of… Read More »

Model Mapper for data response

1. Fund Adaptor Suppose that Fund Adaptor executes a service to search the response data- a monthly or daily (depending on the schedule). This example is to show how the customer details response data is mapped. There are two data transfer objects (DTO) namely CustomerDTO (maybe to present in UI) and CustomerSvcDTO (from executing store procedures… Read More »

Summary of OO hierarchy inheritance mapping strategies

1. Pre-requisites Should read first there types of mapping below: Single-table strategy Joined-tables strategy Table-per-class strategy 2. Summary mapping strategies Table 1: Summary of OO hierarchy inheritance mapping strategies (source: EJB3 in Action) References: D. Pan, R. Rahman, R. Cuprak, M. Remijan, “Mapping inheritance”, In EJB3 in Action,pp.292-293, Manning, Second Edition, 2014

Table-per-class strategy for mapping inheritance with JPA

1. Table-per-class strategy Table-per-class strategy is similar to  joined-tables strategy because each entity in domain model gets its own table. One significant difference is no relationship between the tables, which doesn’t take advantage of power of relational database at all. Following the stock market example in join-table-strategy and single-table-strategy , we are there different tables namely product, bonds, shares but product_code, description, version… Read More »

Joined-tables strategy for mapping inheritance with JPA

1. Joined-tables strategy Follow up the Single-table strategy for mapping inheritance with JPA, this strategy stores all financial products in a single table. In contrast, the joined table strategy creates separate tables for each entity in the domain model. This means that the financial product is the parent table and it holds common data for… Read More »

Single-table strategy for mapping inheritance with JPA

1. Stock Market Example Get started on our real market example with investors who want to buy or sell shares on the marketplace of which they are participants. Actually, stockbrokers (brokers) will do trading on behalf of their clients. But, there are different financial products: shares, loan, option, bond, hibrid, future, and so on. So… Read More »