@Embeddable
public class AccountTransactionId implements Serializable {
private String trxDate;
private String acctNo;
private int trxNo;
}
@Entity
public class Transaction {
@EmbeddedId
private AccountTransactionId accountTransactionId;
private int amt;
private int fee;
private String cancelYn;
}
this is my repository. how to make the find method? i don't have any idea about that
List<Map<String, Object>> findByAccountTransactionId_trxDate(String trxDate);
i tried "findByAccountTransactionId_trxDate", "findByAccountTransactionIdTrxDate", "findByIdTrxDate"...
You can write like this:
public interface TransactionRepository extends JpaRepository<Transaction, AccountTransactionId> {
List<Map<String, Object>> findByTrxDateAndAcctNo(String trxDate, String acctNo);
}