hql

1、"select new com.vnv.bank.mutualAccount.actionform.MutualSubAccountForm"
        + "(ab.accountName, ab.accountId , ab.provSeq , ab.citySeq , ab.bankName ,"
        +"sa.accountId , sa.accountName , sa.subAccountType , ab.bankInfo.id ,sa.id) " +
        " from SubAccount sa , AccountBank ab " +
        "where sa.accountBank = ab.id  and sa.id = "

2、" select new  AccountQueryBean(s, a, t) from "
    + " SubAccount s ,Account a ,Transaction t "
    + "where (t.credit=s.id and s.account.id=a.id";

  其中a,s,f 分别是相应的POJO类,AccountQueryBean 结构如下

public class AcctBalHisBean {
AcctBalHis a =null;
SubAccount s =null;
SubAccount sa = null;
    Transaction t = null;

public AcctBalHisBean (){}
public AcctBalHisBean (AcctBalHis a,SubAccount s,SubAccount sa,Transaction t){
  this.a=a;
  this.s=s;
  this.sa = sa;
  this.t = t;

}
String accountId;
String subAccountId;
String balance;
String lockAmount;
String fee;
String accountName;//对方帐户名称
String otherSubAccountId;//对方子帐户id
    String thisAccountName;
    String amount;
String transId;
String upDate;
String beginDate;
String endDate;
String startPage;
String tid;
String ttransId;

public String getTtransId() {
  return t.getTransId();
}
public void setTtransId(String ttransId) {
  this.ttransId = ttransId;
}
public String getTid() {
  return t.getId()+"";
}
public void setTid(String tid) {
  this.tid = tid;
}
public Transaction getT() {
  return t;
}
public void setT(Transaction t) {
  this.t = t;
}
public AcctBalHis getA() {
  return a;
}
public void setA(AcctBalHis a) {
  this.a = a;
}
public String getAccountId() {
  return s.getAccountId();
}
public void setAccountId(String accountId) {
  this.accountId = accountId;
}
public String getAccountName() {
  return sa.getAccount().getName();
}
public void setAccountName(String accountName) {
  this.accountName = accountName;
}
public String getBalance() {
  return a.getBalance()+"";
}
public void setBalance(String balance) {
  this.balance = balance;
}
public String getFee() {
  return a.getFee()+"";
}
public void setFee(String fee) {
  this.fee = fee;
}
public String getLockAmount() {
  return a.getLockAmount()+"";
}
public void setLockAmount(String lockAmount) {
  this.lockAmount = lockAmount;
}
public SubAccount getS() {
  return s;
}
public void setS(SubAccount s) {
  this.s = s;
}
public SubAccount getSa() {
  return sa;
}
public void setSa(SubAccount sa) {
  this.sa = sa;
}
public String getSubAccountId() {
  return a.getId()+"";
}
public void setSubAccountId(String subAccountId) {
  this.subAccountId = subAccountId;
}
public String getTransId() {
  return a.getTransid()+"";
}
public void setTransId(String transId) {
  this.transId = transId;
}
public String getUpDate() {
  return a.getUpdateTime()+"";
}
public void setUpDate(String upDate) {
  this.upDate = upDate;
}
public String getAmount() {
  return a.getAmount()+"";
}
public void setAmount(String amount) {
  this.amount = amount;
}
public String getThisAccountName() {
  return s.getAccountName();
}
public void setThisAccountName(String thisAccountName) {
  this.thisAccountName = thisAccountName;
}
public String getOtherSubAccountId() {
  return sa.getAccount().getId()+"";
}
public void setOtherSubAccountId(String otherSubAccountId) {
  this.otherSubAccountId = otherSubAccountId;
}

}

你可能感兴趣的:(HQL)