I am using a PostgreSQL DB with two tables: a parent table A and child table B, where a one-to-many relationship applies. We manage our data using the activejdbc library.
The parent table A has a composite primary key, consisting of an id (serial) and timestamp (automatically populated on row insertion).
The child table B has these PKs as foreign keys.
We use a Java application with activejdbc to persists records in our database. Currently, the challenge is on how we should define our models to allow for insertion on the data.
I have read through the docs of activejdbc and checked SO but could not find an example of how to configure this with our models.
Is this possible at all, using a composite PK that contains a timestamp which is auto-generated on insert? And if so, how do we need to configure our child model (table B) to successfully persist?
Our parent table A works, so this purely about the parent-child relationship.