Cuma mau belajar sih. Sudah bisa jalan mappingnya sekarang namun bagaimana cara persist nya? Saya binggung karena ketika saya persist hanya class yang parent yang persist.
<entity class="kyro.accounting.entity.Transaction"> <table name="transaction"> </table> <attributes> <id name="id"> <column name="id"/> <generated-value strategy="AUTO"/> </id> <basic name="creditAmount"> <column name="creditAmount"/> </basic> <basic name="isDeleted"> <column name="isDeleted"/> </basic> <basic name="fileId"> <column name="fileId"/> </basic> <one-to-many name="transactionDetailList" mapped-by="transaction"/> </attributes> </entity> <entity class="kyro.accounting.entity.TransactionDetail"> <table name="transactionDetail"> </table> <attributes> <id name="id"> <column name="id"/> <generated-value strategy="AUTO"/> </id> <basic name="accountId"> <column name="accountId"/> </basic> <basic name="creditAmount"> <column name="creditAmount"/> </basic> <basic name="debitAmount"> <column name="debitAmount"/> </basic> <basic name="fileId"> <column name="fileId"/> </basic> <many-to-one name="transaction"> <join-column name="transactionId" referenced-column-name="id"/> </many-to-one> </attributes> </entity> /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kyro.accounting.entity; import java.io.Serializable; import java.util.List; /** * * @author fahrur */ public class Transaction implements Serializable{ private Long id; private List<TransactionDetail> transactionDetailList; private Boolean isDeleted; private int fileId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean getIsDeleted() { return isDeleted; } public void setIsDeleted(Boolean isDeleted) { this.isDeleted = isDeleted; } public List<TransactionDetail> getTransactionDetailList() { return transactionDetailList; } public void setTransactionDetailList(List<TransactionDetail> transactionDetailList) { this.transactionDetailList = transactionDetailList; } public int getFileId() { return fileId; } public void setFileId(int fileId) { this.fileId = fileId; } } /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kyro.accounting.entity; import java.io.Serializable; /** * * @author fahrur */ public class TransactionDetail implements Serializable{ private Long id; private Transaction transaction; private int accountId; private double creditAmount; private double debitAmount; private int fileId; public int getAccountId() { return accountId; } public void setAccountId(int accoaccountIdnt) { this.accountId = accountId; } public double getCreditAmount() { return creditAmount; } public void setCreditAmount(double creditAmount) { this.creditAmount = creditAmount; } public double getDebitAmount() { return debitAmount; } public void setDebitAmount(double debitAmount) { this.debitAmount = debitAmount; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Transaction getTransaction() { return transaction; } public void setTransaction(Transaction transaction) { this.transaction = transaction; } public int getFileId() { return fileId; } public void setFileId(int fileId) { this.fileId = fileId; } } --- In jug-indonesia@yahoogroups.com, Ifnu bima <ifnub...@...> wrote: > > > Saya dapat error ketika buat jpa pake spring. > > wait wait, udah declare kalau pake JPA kenapa masih ada XML mapping? > harusnya kalau pake JPA pakenya annotation bukan? > > > -- > > > http://ifnu.artivisi.com > +62 856 9211 8687 > regards >