我想proposalInsuredPersonList
从lifeProposal
Object 中检索。但我得到了这个异常proposal.ProposalInsuredPerson cannot be
cast to java.util.List
。让我知道如何检索List
。
query.append("SELECT f.id, f.submittedDate, f.proposalNo, f.customer, f.organization, pi.proposedPremium, pi.proposedSumInsured, s.date, " +
"f.agent, f.proposalInsuredPersonList FROM LifeProposal f,LifeSurvey s INNER JOIN f.proposalInsuredPersonList pi where f.id = s.lifeProposal.id and f.id is not null");
objectList = q.getResultList();
for(Object[] b : objectList) {
porposalId = (String) b[0];
proposalDate = (Date) b[1];
porposalNo = (String) b[2];
if(b[4] == null) {
Customer c = (Customer) b [3];
customerName = c.getFullName();
customerAddress = c.getFullAddress();
fatherName = c.getFatherName();
phNo = c.getContentInfo() == null ? "" : c.getContentInfo().getPhone() ;
} else {
Organization org = (Organization) b[4];
customerName = org.getName();
customerAddress = org.getFullAddress();
fatherName = null;
phNo = org.getContentInfo() == null ? "" : org.getContentInfo().getPhone() ;
}
inspectionDate = (Date) b[7];
premium = (Double) b[5];
sumInsured = (Double) b[6];
if(b[8] == null) {
agentName = "";
agentNo = "";
} else {
Agent a = (Agent) b[8];
agentName = a.getName();
agentNo = a.getCodeNo();
}
insuredPersonList = (List<ProposalInsuredPerson>) b[9];