I have an existing data scheme I'm reluctant to change. There are two entities/tables: parent
and child
, with child having the foreign key column parent_id
. It's a 1(parent)-to-n(children) relationship.
Is it possible within Spring Data JDBC to have Child
class reference Parent
and not Parent
have a Set<Child>
property? Maybe both? (I know it is possible with hibernate, but I'd like to stay with JDBC).
I.e. I want something like this:
@Data
public class Parent {
@Id
private Long id;
}
@Data
public class Child {
@Id
private Long id;
private Parent parent;
}
Somewhat related question: Spring Data JDBC invert OneToOne navigation