2017-02-24 43 views
1

春天 - 休眠javax.el.MethodNotFoundException:找不到方法:

新手在這裏,可以請有人幫助我找到我失蹤。我正在嘗試做收款人和付款人之間的關係。我的問題是即時得到這個錯誤:

javax.el.MethodNotFoundException: Method not found: class com.supportmanagement.model.Payee.getPayor() 
javax.el.Util.findWrapper(Util.java:349) 
javax.el.Util.findMethod(Util.java:211) 
javax.el.BeanELResolver.invoke(BeanELResolver.java:150) 

的List.jsp {} payeelist通過map.put( 「payeelist」,payeeServices.getPayees())來自我控制器;

... 
<c:forEach items="${payeelist}" var="payee" varStatus="payeeindex"> 
     <tr> 
      <td class="pad-0"> </td> 
      <td><a href="/SupportManager/payee/edit/${payee.getCaseNumber()}"><c:out value="${payee.getCaseNumber()}" /></a></td> 
      <td><c:out value="${payee.getLastname()}" /></td> 
      <td><c:out value="${payee.getFirstname()}" /></td> 
      <td><c:out value="${payee.getMiddlename()}" /></td> 
      <td class="text-center"><a href="/SupportManager/payor/add?casenumber=${payee.getCaseNumber()}"> 
       ${payee.getPayor().getCaseNumber()} 
      </a></td> 
      <td class="text-center"><a href="">ADD PAYMENT</a> <a href="" class="pull-right" title="Print Envelope"><i class="glyphicon glyphicon-envelope"></i></a> </td> 
     </tr> 
    </c:forEach> 
... 

Payee.java

package com.supportmanagement.model; 

import java.io.Serializable; 
import java.util.Date; 
import java.util.List; 

import javax.persistence.CascadeType; 
import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.FetchType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.OneToMany; 
import javax.persistence.Table; 

@Entity 
@Table(name = "payeeMaster") 
public class Payee implements Serializable { 

private static final long serialVersionUID = 5876875389515595233L; 

@Id 
@Column(name = "CaseNumber", unique = true, nullable = false) 
private String CaseNumber; 

@Column(name = "Firstname") 
private String Firstname; 

@Column(name = "Lastname") 
private String Lastname; 

@Column(name = "Middlename") 
private String Middlename; 

@Column(name = "Address1") 
private String Address1; 

@Column(name = "Address2") 
private String Address2; 

@Column(name = "City") 
private String City; 

@Column(name = "State") 
private String State; 

@Column(name = "Zip") 
private String Zip; 

@Column(name = "HomePhone") 
private String HomePhone; 

@Column(name = "MobilePhone") 
private String MobilePhone; 

@Column(name = "Active") 
private int Active; 

@Column(name = "Comments") 
private String Comments; 

@Column(name = "StateCode") 
private String StateCode; 

@Column(name = "PA") 
private int PA; 

@Column(name = "OSE") 
private int OSE; 

@Column(name = "Envelope") 
private int Envelope; 

@Column(name = "AccountNumber") 
private String AccountNumber; 

@Column(name = "DNumber") 
private String DNumber; 

@Column(name = "LastModified") 
private Date LastModified; 

@Column(name = "ModifiedBy") 
private String ModifiedBy; 


private List<Payor> payor; 

@OneToMany(mappedBy="Payor", cascade=CascadeType.ALL, fetch = FetchType.LAZY) 
@JoinColumn(name="CaseNumber") 
public List<Payor> getPayor() { 
    return payor; 
} 

public void setPayor(List<Payor> payor) { 
    this.payor = payor; 
} 

public String getCaseNumber() { 
    return CaseNumber; 
} 

public void setCaseNumber(String caseNumber) { 
    CaseNumber = caseNumber; 
} 

public String getFirstname() { 
    return Firstname; 
} 

public void setFirstname(String firstname) { 
    Firstname = firstname; 
} 

public String getLastname() { 
    return Lastname; 
} 

public void setLastname(String lastname) { 
    Lastname = lastname; 
} 

public String getMiddlename() { 
    return Middlename; 
} 

public void setMiddlename(String middlename) { 
    Middlename = middlename; 
} 

public String getAddress1() { 
    return Address1; 
} 

public void setAddress1(String address1) { 
    Address1 = address1; 
} 

public String getAddress2() { 
    return Address2; 
} 

public void setAddress2(String address2) { 
    Address2 = address2; 
} 

public String getCity() { 
    return City; 
} 

public void setCity(String city) { 
    City = city; 
} 

public String getState() { 
    return State; 
} 

public void setState(String state) { 
    State = state; 
} 

public String getZip() { 
    return Zip; 
} 

public void setZip(String zip) { 
    Zip = zip; 
} 

public String getHomePhone() { 
    return HomePhone; 
} 

public void setHomePhone(String homePhone) { 
    HomePhone = homePhone; 
} 

public String getMobilePhone() { 
    return MobilePhone; 
} 

public void setMobilePhone(String mobilePhone) { 
    MobilePhone = mobilePhone; 
} 

public int getActive() { 
    return Active; 
} 

public void setActive(int active) { 
    Active = active; 
} 

public String getComments() { 
    return Comments; 
} 

public void setComments(String comments) { 
    Comments = comments; 
} 

public String getStateCode() { 
    return StateCode; 
} 

public void setStateCode(String stateCode) { 
    StateCode = stateCode; 
} 

public int getPA() { 
    return PA; 
} 

public void setPA(int pA) { 
    PA = pA; 
} 

public int getOSE() { 
    return OSE; 
} 

public void setOSE(int oSE) { 
    OSE = oSE; 
} 

public int getEnvelope() { 
    return Envelope; 
} 

public void setEnvelope(int envelope) { 
    Envelope = envelope; 
} 

public String getAccountNumber() { 
    return AccountNumber; 
} 

public void setAccountNumber(String accountNumber) { 
    AccountNumber = accountNumber; 
} 

public String getDNumber() { 
    return DNumber; 
} 

public void setDNumber(String dNumber) { 
    DNumber = dNumber; 
} 

public Date getLastModified() { 
    return LastModified; 
} 

public void setLastModified(Date lastModified) { 
    LastModified = lastModified; 
} 

public String getModifiedBy() { 
    return ModifiedBy; 
} 

public void setModifiedBy(String modifiedBy) { 
    ModifiedBy = modifiedBy; 
} 


} 

Payor.java

package com.supportmanager.model; 

import java.io.Serializable; 
import java.util.List; 

import javax.persistence.Column; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Id; 
import javax.persistence.JoinColumn; 
import javax.persistence.ManyToOne; 
import javax.persistence.Table; 

@Entity 
@Table(name = "payorMaster") 
public class Payor implements Serializable { 

private static final long serialVersionUID = -1896406931521329889L; 

@Id 
@GeneratedValue(strategy = GenerationType.AUTO) 
@Column(name = "PayorID") 
private Integer PayorID; 

@Column(name = "CaseNumber") 
private String CaseNumber; 

@Column(name = "PayorFirstname") 
private String PayorFirstname; 

@Column(name = "PayorLastname") 
private String PayorLastname; 

@Column(name = "PayorMiddlename") 
private String PayorMiddlename; 

@Column(name = "PayorAddress1") 
private String PayorAddress1; 

@Column(name = "PayorAddress2") 
private String PayorAddress2; 

@Column(name = "PayorCity") 
private String PayorCity; 

@Column(name = "PayorState") 
private String PayorState; 

@Column(name = "PayorZip") 
private String PayorZip; 

@Column(name = "PayorHomePhone") 
private String PayorHomePhone; 

@Column(name = "PayorMobilePhone") 
private String PayorMobilePhone; 

@Column(name = "PayorActive") 
private int PayorActive; 

@Column(name = "PayorComments") 
private String PayorComments; 

@ManyToOne 
@JoinColumn(name="CaseNumber") 
private List<Payee> payee; 

public Integer getPayorID() { 
    return PayorID; 
} 

public void setPayorID(Integer payorID) { 
    PayorID = payorID; 
} 

public String getCaseNumber() { 
    return CaseNumber; 
} 

public void setCaseNumber(String caseNumber) { 
    CaseNumber = caseNumber; 
} 

public String getPayorFirstname() { 
    return PayorFirstname; 
} 

public void setPayorFirstname(String payorFirstname) { 
    PayorFirstname = payorFirstname; 
} 

public String getPayorLastname() { 
    return PayorLastname; 
} 

public void setPayorLastname(String payorLastname) { 
    PayorLastname = payorLastname; 
} 

public String getPayorMiddlename() { 
    return PayorMiddlename; 
} 

public void setPayorMiddlename(String payorMiddlename) { 
    PayorMiddlename = payorMiddlename; 
} 

public String getPayorAddress1() { 
    return PayorAddress1; 
} 

public void setPayorAddress1(String payorAddress1) { 
    PayorAddress1 = payorAddress1; 
} 

public String getPayorAddress2() { 
    return PayorAddress2; 
} 

public void setPayorAddress2(String payorAddress2) { 
    PayorAddress2 = payorAddress2; 
} 

public String getPayorCity() { 
    return PayorCity; 
} 

public void setPayorCity(String payorCity) { 
    PayorCity = payorCity; 
} 

public String getPayorState() { 
    return PayorState; 
} 

public void setPayorState(String payorState) { 
    PayorState = payorState; 
} 

public String getPayorZip() { 
    return PayorZip; 
} 

public void setPayorZip(String payorZip) { 
    PayorZip = payorZip; 
} 

public String getPayorHomePhone() { 
    return PayorHomePhone; 
} 

public void setPayorHomePhone(String payorHomePhone) { 
    PayorHomePhone = payorHomePhone; 
} 

public String getPayorMobilePhone() { 
    return PayorMobilePhone; 
} 

public void setPayorMobilePhone(String payorMobilePhone) { 
    PayorMobilePhone = payorMobilePhone; 
} 

public int getPayorActive() { 
    return PayorActive; 
} 

public void setPayorActive(int payorActive) { 
    PayorActive = payorActive; 
} 

public String getPayorComments() { 
    return PayorComments; 
} 

public void setPayorComments(String payorComments) { 
    PayorComments = payorComments; 
} 

} 

的applicationContext.xml

.... 
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="packagesToScan" value="com.supportmanagement.model" /> 
    <property name="hibernateProperties"> 
     <props> 
      <prop key="dialect">org.hibernate.dialect.SQLServerDialect</prop> 
      <prop key="show_sql">true</prop> 
      <prop key="enable_lazy_load_no_trans">true</prop> 
      <prop key="default_schema">SupportManagerDB</prop> 
      <prop key="format_sql">true</prop> 
      <prop key="use_sql_comments">true</prop> 
     </props> 
    </property> 
    <property name="annotatedClasses"> 
     <list> 
      <value>com.supportmanagement.model.Payee</value> 
      <value>com.supportmanagement.model.Payor</value> 
     </list> 
    </property> 
</bean> 
.... 

回答

0

在你的JSP頁面使用:

${payee.getPayor().getCaseNumber()} 

現在.. getPayor()返回List<Payor>和列表沒有getCaseNumber()方法。

您可以從列表中的某個付款人,然後調用方法:

${payee.payor[index].caseNumber} 

index是一個硬編碼值或變量。

+0

感謝回覆,但是,現在問題仍然存在方法未找到方法,其現在屬性未找到'javax.el.PropertyNotFoundException:未找到類型com.supportmanagement.model.Payee'上找到屬性'付款人' –

+0

不是當然,如果是這種情況,但你的普賴爾。收款人不應該是一個名單,但收款人類型 –