我有PERSON,ACCOUNT,PERSON_ACCOUNT
(用于Person和Account的多对多关系)表和实体。 现在Account
类型保存,企业,工资.. 这种类型是ACCOUNT_TYPE
表中的预定义值(创建表)。如何为属性提供值如果它是实体的类型?
我有很好的定义关系。为Account
类 小码
class Account{
private AccountType acctype;
}
现在我想创建
Person p = new Person();
p.setFirstName();
p.setLastName();
Account account=new Account();
account.setAccountType() ? // how I get predefine value from database to here?
Set accounts; // other code to create set
p.setAccounts(accounts);
我的问题是我怎么写account.setAccountType(accountTypeEntity.getAccountType())
?
它不应该插入数据到ACCOUNT_TYPE
表。
先生的数据是已经存在像(储蓄,企业,工资)..但我如何给价值account.setAccountType(上面一个?) – user3543851 2014-08-28 09:32:15
展我可以使用代码从会话管理器加载帐户类型“保存”。 – 2014-08-28 09:33:04