Title_id column by default is auto increment by trigger.
By using this method, you will get:
- 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)
- You can’t get return value of the object because of this duplication.
What I want are:
- User can insert data from the back door or directly to the table
- Trigger is ignored when new record is inserted from the application. It means the title_id is generated by our JPA Configuration.
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.
- User input directly to the table and insert title_id which is not generated by triggers.
- Portability, changing DBMS means create new triggers and sequence.