Configuring Trigger Tables

less than 1 minute read

Random-JPA provides a way to load tables generated by triggers. Although it only supports fetching of tables generated by trigger and does load entities if only column values are modified.

Note: If entity is declared as Trigger tables, random values will not be generated for this entity.

Let us say that we have trigger which logs history of all the bank transaction taking place. “Transaction” has two foreign keys, one maps to personId and other to accountId.

final JPAContextFactory jpaContextFactory = JPAContextFactory
    .newInstance(Database.MY_SQL, entityManager);
        .withLink(Transaction_.accountId, Account_.accountId));

So when you load trigger table “Transaction” it will query the table to fetch row with mapped personId & accountId



Kumar Rohit

Kumar Rohit

I like long drives, bike trip & good food. I have passion for coding, especially for Clean-Code.

Leave a comment