First,I have 2 tables.
Quote:
t_user(id,name)
t_info(id,refer_id,refer_table,text)
if t_user.id = 7, i will find one record in table t_info, and the data is like this
[123,7,'t_user','something']
my Code is
Code:
@Entity
@Table(name = "t_user")
public class User implements Serializable {
@Id
protected String id;
@Column
protected String name;
}
@Entity
@Table(name = "t_info")
public class Info implements Serializable{
@Id
private String id;
@Column
private String referId;
@Column
private String referTable;
@Column
private String text;
}
@Entity
public class UserText extends User{
@OneToOne
@JoinColumn(name="id",referencedColumnName="refer_id")
private Info info;
}
I just want get two Repositories: Repository<User> and Repository<UserText>
Repository<User> for query and Repository<UserText> for save.
But i know 2 tables can not mapping 3 entities.
How to do?
Somebody help me,Thanks a lot....