Hello,
I have two classes like these:
Code:
@Entity
@Table(name="banks")
public class Banks {
private Long id;
private List contact_persons;
....
@OneToMany(targetEntity=BankContactPerson.class)
@IndexColumn(name=idx)
public List getContact_persons() {
....
}
}
and the child:
Code:
@Entity
@Table(name="bank_contact_persons")
public class BankContactPerson() {
private Long id;
private String name;
....
}
if I want to populate bank (with the child also), it will generate an error like this:
Code:
WARNING: SQL Error: 1146, SQLState: 42S02
SEVERE: Table 'db.banks_bank_contact_persons' doesn't exist
SEVERE: >>org.hibernate.exception.SQLGrammarException: could not initialize a collection: [willow.beansdao.Bank.contact_persons#5]
I never declare table "banks_bank_contact_persons". it seems that it comes from table "banks" specified in Bank class, and table "bank_contact_persons" in BankContactPerson class.
and if I change the table name in BankContactPerson class to be "contact_persons" and the table name in database to be "banks_contact_persons" (hoping that the resulting table will be "banks_contact_person"), the error is like this:
Code:
SEVERE: Table 'indoscale-e.contact_persons' doesn't exist
how can I solve this? the child of "banks" table is "bank_contact_persons"
thank you