我有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