I think you need to create the BoyGirl class, because the BOY_GIRL table BOY_GIRL not a simple many-to-many table (if there is one, then the columns should be only boy_id and girl_id ). So, what you need to do is create the BoyGirl class, and then match BOY - BOY_GIRL with one-to-many, and also map GIRL to BOY_GIRL with one-to-many
table relationships
+-------+ +--------------+ +-------+ | BOY | | BOY_GIRL | | GIRL | +-------+ +--------------| +-------+ | id | 0..* --- 1..1 | id | 1..1 --- 0..* | id | | name | | boy_id | | name | | birth | | girl_id | | birth | +-------+ | start_dating | +-------+ +--------------+
Java classes
public class BoyGirl { private long id; private Boy boy; private Girl girl; private Date startDating; } public class Boy {
Required Selection Request
source share