in all the tutorial, they use the entire object for one-to-many relationship like so:
but I usually don't use the actual parent object inside child class, just the id of the parent, to mimic the behavior in table. how do I achieve this? so in Detail class, instead of "private Header parentHeader;", I'll just use "private in header_id;" (be careful since both Detail and Header class has "id" field).
Intuitively, I would make something like @OneToMany(fetch = FetchType.LAZY) to annotate the List<Detail> details in Header class and put @JoinColumn(entity = Header.class, colName = "id") in the header_id field in Detail Class. I also need to know how to do this for multiple foreign key (usually for legacy database designs).