Environment:
- Hibernate 4.1.6.final
- Spring 3.1.2.release
- Spring JPA 1.1.0.release
- PostgreSQL 9.1-901-1.jdbc4
I decided to rephrase the questions.
There are 2 tables:
public company
{
private Long id;
private Long name;
private address table_address;
}
public address
{
private Long id;
private String address;
private Long company_id;
}
Note: both table id is sequential and no related. Except table.address.company_id
is foreign key of company.
how to do mapping? what result i expected is:
"company":{
"id":4,
"name":"company name",
"address":{
"id":3,
"address":"anywhere",
"company_id":4
}
}
So can somebody teach me that, how to map this 2 table?