Change Thymeleaf default view location

Written by Dwi Ardi Irawan. Posted in Spring Framework, Thymeleaf

Secara default Thymeleaf  template terletak di folder template yang ada di source folder resources. Biarkan folder template tersebut dalam keadaan kosong atau tidak ada file apapun di dalamnya. Kemudian buat folder di dalam folder WEB-INF dan letakkan file .html(Thymeleaf ) di dalamnya.

thymeleaf1

Buat konfigurasi agar spring mengenali letak lokasi Thymeleaf  template yang baru.

thymeleaf2

Untuk mendownload contoh hasil jadinya silahkan klik link berikut: https://github.com/dwiardiirawan/SpringThymeleafTemplate

JPA implementation with Hibernate & Oracle Primary Key Sequences/Triggers

Written by Dwi Ardi Irawan. Posted in Uncategorized

TABLE: TR_TITLE
Column Name Data Type
title_id(PK) NUMBER
title VARCHAR2
code $VARCHAR2
NOTE: Title_id column by default is auto increment by trigger. By using this method, you will get:
  1. Two records will be inserted in TR_TITLE table(duplicate with different title_id, one is generated by triggers and other is generated by hibernate)
  2. You can’t get return value of the object because of this duplication.
What I want are:
  1. User can insert data from the back door or directly to the table
  2. Trigger is ignored when new record is inserted from the application. It means the title_id is generated by our JPA Configuration.
SOLUTION: NOTE: add condition when the inserted title_id null, get the auto increment sequence from database’s sequence and when the inserted title id is not null, auto increment sequence is generated from our JPA configuration. Disadvantage:
  1. User input directly to the table and insert title_id which is not generated by triggers.
  2. Portability, changing DBMS means create new triggers and sequence.

Hello World!

Written by Dwi Ardi Irawan. Posted in Uncategorized

Good Day! Finally I can share my personal website to the world wide web. This website is a representation of my ideas, my opinions, my ego and my idealism as a person and as a software engineer. I really hope what is written on this website will be useful for others. Last but not least, thank you for reading and feel free to comment.