Hey guys,

I am new to MyBatis so I hope you guys do not mind me asking a couple of questions.

1) When trying to insert into db , it does not return the object I am saving, is it possible to return that object somehow ? if not then how can i approach a situation when I have a method create account and after hitting the controller it should return account object its generated id and other fields?

Below is the method which i would like to return Account

 @Options(useGeneratedKeys=true, keyProperty = "id", keyColumn="id")
 @Insert("INSERT INTO ACCOUNT(customerId,country) values (#{customerId},#{country})")
 void createAccount(Account account);

2) If i have a Balance table and Account table and account should have list of Balance and when somebody calling createAccount it passes list of balances how would i proceed using mybatis ?

public class AccountCreateRequest {
    private Long customerId;
    private String country;
    private List<String> currencies;
}

public class Account {

    @Id
    private Long id;

    @Column("country")
    private String country;

    @Column("customerId")
    private Long customerId;

    List<Balance> balances;

}

Comment From: jeffgbutler

Closed in favor of StackOverflow.