action类
package com.log.action;import java.util.Calendar;
import com.log.common.BaseAction;
import com.log.common.Page;
import com.log.manager.customer_customer_Manager;@SuppressWarnings("serial")
public class customer_customerAction extends BaseAction{
private customer_customer_Manager customer_customer_manager;
private Page page;

private Integer id;
private String code;
private String brief;
private int company;
private String chName;
private String enName;
private int sales;
private int country;
private int area;
private String chAddress;
private String enAddress;
private Calendar  regDate;
private String regMoney;
private String bussinessLicense;
private int nature;
    private String legalPerson;
    private boolean sex;
private String phone;
private String email;
private boolean sea;
private boolean air;
private boolean declaration;
private boolean storage;
private boolean haulage;
private boolean portAgent;
private boolean airAgent;
private boolean manufacturer;
private boolean boatCOMP;
private boolean airCOMP;
private boolean forwarder;
private boolean declarationCOMP;
private boolean trailerCOMP;
private boolean storageCOMP;
private boolean tradeCOMP;
private boolean expressCOMP;
private boolean notifyParty;
private boolean suppliers;
private boolean other;

public String listCustomerAll() throws Exception {
page=new Page();
// int start = Integer.valueOf(getRequest().getParameter("start"));
// int limit = Integer.valueOf(getRequest().getParameter("limit"));
int start =0;
int limit =2;
page.setStart(start);
page.setLimit(limit);
page = customer_customer_manager.customer_listall(page, start, limit);
if (null != page.getRoot()) {
page.setSuccess(true);
}
return SUCCESS;
}
//get and set method
public Page getPage() {
return page;
}
public void setPage(Page page) {
this.page = page;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getBrief() {
return brief;
}
public void setBrief(String brief) {
this.brief = brief;
}
public int getCompany() {
return company;
}
public void setCompany(int company) {
this.company = company;
}
public String getChName() {
return chName;
}
public void setChName(String chName) {
this.chName = chName;
}
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public int getSales() {
return sales;
}
public void setSales(int sales) {
this.sales = sales;
}
public int getCountry() {
return country;
}
public void setCountry(int country) {
this.country = country;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public String getChAddress() {
return chAddress;
}
public void setChAddress(String chAddress) {
this.chAddress = chAddress;
}
public String getEnAddress() {
return enAddress;
}
public void setEnAddress(String enAddress) {
this.enAddress = enAddress;
}
public Calendar getRegDate() {
return regDate;
}
public void setRegDate(Calendar regDate) {
this.regDate = regDate;
}
public String getRegMoney() {
return regMoney;
}
public void setRegMoney(String regMoney) {
this.regMoney = regMoney;
}
public String getBussinessLicense() {
return bussinessLicense;
}
public void setBussinessLicense(String bussinessLicense) {
this.bussinessLicense = bussinessLicense;
}
public int getNature() {
return nature;
}
public void setNature(int nature) {
this.nature = nature;
}
public String getLegalPerson() {
return legalPerson;
}
public void setLegalPerson(String legalPerson) {
this.legalPerson = legalPerson;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean isSea() {
return sea;
}
public void setSea(boolean sea) {
this.sea = sea;
}
public boolean isAir() {
return air;
}
public void setAir(boolean air) {
this.air = air;
}
public boolean isDeclaration() {
return declaration;
}
public void setDeclaration(boolean declaration) {
this.declaration = declaration;
}
public boolean isStorage() {
return storage;
}
public void setStorage(boolean storage) {
this.storage = storage;
}
public boolean isHaulage() {
return haulage;
}
public void setHaulage(boolean haulage) {
this.haulage = haulage;
}
public boolean isPortAgent() {
return portAgent;
}
public void setPortAgent(boolean portAgent) {
this.portAgent = portAgent;
}
public boolean isAirAgent() {
return airAgent;
}
public void setAirAgent(boolean airAgent) {
this.airAgent = airAgent;
}
public boolean isManufacturer() {
return manufacturer;
}
public void setManufacturer(boolean manufacturer) {
this.manufacturer = manufacturer;
}
public boolean isBoatCOMP() {
return boatCOMP;
}
public void setBoatCOMP(boolean boatCOMP) {
this.boatCOMP = boatCOMP;
}
public boolean isAirCOMP() {
return airCOMP;
}
public void setAirCOMP(boolean airCOMP) {
this.airCOMP = airCOMP;
}
public boolean isForwarder() {
return forwarder;
}
public void setForwarder(boolean forwarder) {
this.forwarder = forwarder;
}
public boolean isDeclarationCOMP() {
return declarationCOMP;
}
public void setDeclarationCOMP(boolean declarationCOMP) {
this.declarationCOMP = declarationCOMP;
}
public boolean isTrailerCOMP() {
return trailerCOMP;
}
public void setTrailerCOMP(boolean trailerCOMP) {
this.trailerCOMP = trailerCOMP;
}
public boolean isStorageCOMP() {
return storageCOMP;
}
public void setStorageCOMP(boolean storageCOMP) {
this.storageCOMP = storageCOMP;
}
public boolean isTradeCOMP() {
return tradeCOMP;
}
public void setTradeCOMP(boolean tradeCOMP) {
this.tradeCOMP = tradeCOMP;
}
public boolean isExpressCOMP() {
return expressCOMP;
}
public void setExpressCOMP(boolean expressCOMP) {
this.expressCOMP = expressCOMP;
}
public boolean isNotifyParty() {
return notifyParty;
}
public void setNotifyParty(boolean notifyParty) {
this.notifyParty = notifyParty;
}
public boolean isSuppliers() {
return suppliers;
}
public void setSuppliers(boolean suppliers) {
this.suppliers = suppliers;
}
public boolean isOther() {
return other;
}
public void setOther(boolean other) {
this.other = other;
}
public void setCustomer_customer_manager(
customer_customer_Manager customer_customer_manager) {
this.customer_customer_manager = customer_customer_manager;
}



}

解决方案 »

  1.   


    异常如下:-------------------------------------------------------------------------------------------------
    Hibernate: select customer_c0_.id as id8_, customer_c0_.code as code8_, customer_c0_.brief as brief8_, customer_c0_.company as company8_, customer_c0_.chName as chName8_, customer_c0_.enName as enName8_, customer_c0_.sales as sales8_, customer_c0_.country as country8_, customer_c0_.area as area8_, customer_c0_.chAddress as chAddress8_, customer_c0_.enAddress as enAddress8_, customer_c0_.regDate as regDate8_, customer_c0_.regMoney as regMoney8_, customer_c0_.bussinessLicense as bussine14_8_, customer_c0_.nature as nature8_, customer_c0_.legalPerson as legalPe16_8_, customer_c0_.sex as sex8_, customer_c0_.phone as phone8_, customer_c0_.email as email8_, customer_c0_.sea as sea8_, customer_c0_.air as air8_, customer_c0_.declaration as declara22_8_, customer_c0_.storage as storage8_, customer_c0_.haulage as haulage8_, customer_c0_.portAgent as portAgent8_, customer_c0_.airAgent as airAgent8_, customer_c0_.manufacturer as manufac27_8_, customer_c0_.boatCOMP as boatCOMP8_, customer_c0_.airCOMP as airCOMP8_, customer_c0_.forwarder as forwarder8_, customer_c0_.declarationCOMP as declara31_8_, customer_c0_.trailerCOMP as trailer32_8_, customer_c0_.storageCOMP as storage33_8_, customer_c0_.tradeCOMP as tradeCOMP8_, customer_c0_.expressCOMP as express35_8_, customer_c0_.notifyParty as notifyP36_8_, customer_c0_.suppliers as suppliers8_, customer_c0_.other as other8_ from tb_customer_customer customer_c0_ order by customer_c0_.id desc limit ?
    2011-3-23 16:38:50 org.apache.catalina.core.StandardWrapperValve invoke
    严重: Servlet.service() for servlet default threw exception
    java.lang.IllegalArgumentException
    at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(Unknown Source)
    at java.lang.reflect.Field.set(Unknown Source)
    at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:102)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:360)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:221)
    at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3594)
    at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:152)
    at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
    at org.hibernate.loader.Loader.doQuery(Loader.java:752)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.doList(Loader.java:2228)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    at org.hibernate.loader.Loader.list(Loader.java:2120)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    这是个什么原因呀 说不合法的参数
      

  2.   

    hibernate 查询的是实体么?实体要实现序列化的并且配置文件全么?
    看你这个Action太乱啦 Action和实体要分开啊
      

  3.   

    最好分层,不分层分类也行。
    select customer_c0_.id as id8_, customer_c0_.code as code8_, customer_c0_.brief as brief8_, customer_c0_.company as company8_, customer_c0_.chName as chName8_, customer_c0_.enName as enName8_, customer_c0_.sales as sales8_, customer_c0_.country as country8_, customer_c0_.area as area8_, customer_c0_.chAddress as chAddress8_, customer_c0_.enAddress as enAddress8_, customer_c0_.regDate as regDate8_, customer_c0_.regMoney as regMoney8_, customer_c0_.bussinessLicense as bussine14_8_, customer_c0_.nature as nature8_, customer_c0_.legalPerson as legalPe16_8_, customer_c0_.sex as sex8_, customer_c0_.phone as phone8_, customer_c0_.email as email8_, customer_c0_.sea as sea8_, customer_c0_.air as air8_, customer_c0_.declaration as declara22_8_, customer_c0_.storage as storage8_, customer_c0_.haulage as haulage8_, customer_c0_.portAgent as portAgent8_, customer_c0_.airAgent as airAgent8_, customer_c0_.manufacturer as manufac27_8_, customer_c0_.boatCOMP as boatCOMP8_, customer_c0_.airCOMP as airCOMP8_, customer_c0_.forwarder as forwarder8_, customer_c0_.declarationCOMP as declara31_8_, customer_c0_.trailerCOMP as trailer32_8_, customer_c0_.storageCOMP as storage33_8_, customer_c0_.tradeCOMP as tradeCOMP8_, customer_c0_.expressCOMP as express35_8_, customer_c0_.notifyParty as notifyP36_8_, customer_c0_.suppliers as suppliers8_, customer_c0_.other as other8_ from tb_customer_customer customer_c0_ order by customer_c0_.id desc limit ?
    这是什么啊?
    找一下.hbm.xml中的字段对应关系和数据库是否对应。在应用中是否配置.hbm.xml文件使用。
      

  4.   

    实体当然有了  写了实体就不用再action中在写get set方法了吗
    我现在是先写了实体类  在action中在写一遍各个属性的get set方法
    请赐教
      

  5.   

    get、set方法在实体中写了,action调用不是也一样吗?为什么你写两次呢
      

  6.   

    建议你去找个简单点的spring+hibernate示例看看,一般教材里的就行,浅显易懂,最好能跑起来,加断点自己跟跟代码