同意ls
 仔细查看 你的 id 
最好贴点代码出来。

解决方案 »

  1.   

    啊action代码
    /**
     * 本程序用于会员注册
     */
    package action.loginandregister;
    import java.util.*;
    import com.opensymphony.xwork2.ActionContext;
    import action.base.BaseAction;
    public class EnterpriseRegiste extends BaseAction{
    private String username;
    private String password;
    private String email;
    private String tradeCode;
    private Integer mostType;
    private Integer bigType;
    private Integer type;
    private Integer domain;
    private Integer trade;
    private Integer proid;
    private Integer cid;
    private Integer town;
    private String product;
    private String enterprise;
    private String enterpriseaddress;
    private String netname;
    private Integer nettype;
    private Integer fmtype;
    private Integer fbigtype;
    private Integer ftype;
    private Integer fdomain;
    private Integer ftrade;
    private String touchperson;
    private String tel;
    private String department;
    private String introduce;
    private Date update;//公司成立时间
    private String vercode;
    public String execute()throws Exception{
    Map session = ActionContext.getContext().getSession();
    String ver2 = (String )session.get("rand");
    session.put("rand" , null);
    if(vercode.equals(ver2)){
    if(username.trim().length()<6 || username.trim().length()>20 || password.trim().length()<6 
    || email.indexOf("@")<0||email.indexOf(".")<0||mostType.equals("")||mostType==null
    || bigType.equals("")||bigType==null||type.equals("")||type==null||domain.equals("")
    ||domain==null||trade.equals("")||trade==null||proid.equals("")||proid==null||cid.equals("")
    ||cid==null||town.equals("")||town==null||product.trim().length()>500
    ||touchperson.trim().length()<2||tel.trim().length()<11||department.trim().length()<2
    ||enterprise.trim().length()<2||checkUser.checkUserByUserName(username)!=null
    ||checkUser.checkUserByEmail(email)!=null){
    System.out.println(username);
    System.out.println(password);
    System.out.println(email);
    System.out.println(tradeCode);
    System.out.println(mostType);
    System.out.println(bigType);
    System.out.println(type);
    System.out.println(domain);
    System.out.println(trade);
    System.out.println(proid);
    System.out.println(cid);
    System.out.println(town);
    System.out.println(product);
    System.out.println(enterprise);
    System.out.println(enterpriseaddress);
    System.out.println(netname);
    System.out.println(nettype);
    System.out.println(fmtype);
    System.out.println(fbigtype);
    System.out.println(ftype);
    System.out.println(fdomain);
    System.out.println(ftrade);
    System.out.println(touchperson);
    System.out.println(tel);
    System.out.println(department);
    System.out.println(introduce);
    System.out.println(update);
    System.out.println(vercode);
    addActionError("您填写的数据不合法,请按提示填写,打“*”的为必填项");
    return "failure";
    }else{
    Integer groom=1;
    Integer number=1;
    Integer nuorder=0;
    Integer freeze=0;
    enterpriseuser.save(username.trim(),password.trim(), email.trim(), tradeCode.trim(), mostType, bigType, type, domain, trade, proid, cid, town, product.trim(), enterprise.trim(), enterpriseaddress.trim(),update, netname.trim(), nettype, fmtype, fbigtype, ftype, fdomain, ftrade, touchperson.trim(), tel.trim(), department.trim(), introduce, groom, number, nuorder, freeze);
    String usertype=enterprise;
    session.put("username",username);
    session.put("usertype",usertype);
    return "success";
    }
    }else{
    addActionError("验证码不匹配!");
    return "failure";
    }

    }

    public void setUsername(String username){
    this.username=username;
    }
    public String getUsername(){
    return this.username;
    }
    public void setPassword(String password){
    this.password=password;
    }
    public String getPassword(){
    return this.password;
    }
    public void setEmail(String email){
    this.email=email;
    }
    public String getEmail(){
    return this.email;
    }
    public void setTradeCode(String tradeCode){
    this.tradeCode=tradeCode;
    }
    public String getTradeCode(){
    return this.tradeCode;
    }
    public void setMostType(Integer mostType){
    this.mostType=mostType;
    }
    public Integer getMostType(){
    return this.mostType;
    }
    public void setBigType(Integer bigType){
    this.bigType=bigType;
    }
    public Integer getBigType(){
    return this.bigType;
    }
    public void setType(Integer type){
    this.type=type;
    }
    public Integer getType(){
    return this.type;
    }
    public void setDomain(Integer domain){
    this.domain=domain;
    }
    public Integer getDomain(){
    return this.domain;
    }
    public void setTrade(Integer trade){
    this.trade=trade;
    }
    public Integer getTrade(){
    return this.trade;
    }
    public void setProid(Integer proid){
    this.proid=proid;
    }
    public Integer getProid(){
    return this.proid;
    }
    public void setCid(Integer cid){
    this.cid=cid;
    }
    public Integer getCid(){
    return this.cid;
    }
    public void setTown(Integer town){
    this.town=town;
    }
    public Integer getTown(){
    return this.town;
    }
    public void setProduct(String product){
    this.product=product;
    }
    public String getProduct(){
    return this.product;
    }
    public void setEnterprise(String enterprise){
    this.enterprise=enterprise;
    }
    public String getEnterprise(){
    return this.enterprise;
    }
    public void setEnterpriseaddress(String enterpriseaddress){
    this.enterpriseaddress=enterpriseaddress;
    }
    public String getEnterpriseaddress(){
    return this.enterpriseaddress;
    }
    public void setNetname(String netname){
    this.netname=netname;
    }
    public String getNetname(){
    return this.netname;
    }
    public void setNettype(Integer nettype){
    this.nettype=nettype;
    }
    public Integer getNettype(){
    return this.nettype;
    }
    public void setFmtype(Integer fmtype){
    this.fmtype=fmtype;
    }
    public Integer getFmtype(){
    return this.fmtype;
    }
    public void setFbigtype(Integer fbigtype){
    this.fbigtype=fbigtype;
    }
    public Integer getFbigtype(){
    return this.fbigtype;
    }
    public void setFtype(Integer ftype){
    this.ftype=ftype;
    }
    public Integer getFtype(Integer type){
    return this.ftype;
    }
    public void setFdomain(Integer fdomain){
    this.fdomain=fdomain;
    }
    public Integer getFdomain(){
    return this.fdomain;
    }
    public void setFtrade(Integer ftrade){
    this.ftrade=ftrade;
    }
    public Integer getFtrade(){
    return this.ftrade;
    }
    public void setTouchperson(String touchperson){
    this.touchperson=touchperson;
    }
    public String getTouchperson(){
    return this.touchperson;
    }
    public void setTel(String tel){
    this.tel=tel;
    }
    public String getTel(){
    return this.tel;
    }
    public void setDepartment(String department){
    this.department=department;
    }
    public String getDepartment(){
    return this.department;
    }
    public void setIntroduce(String introduce){
    this.introduce=introduce;
    }
    public String getIntroduce(){
    return this.introduce;
    }
    public void setVercode(String vercode){
    this.vercode=vercode;
    }
    public String getVercode(){
    return this.vercode;
    }
    public void setUpdate(Date update){
    this.update=update;
    }
    public Date getUpdate(){
    return this.update;
    }
    }
      

  2.   

    hibernate配置文件
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
    <hibernate-mapping package="model">
    <class name="Fenterpriseuser" table="fenterpriseuser">
    <id name="id" type="integer" column="fenterprise_id">
    <generator class="identity"/>
    </id>

    <property name="freeze" column="fenterprise_freeze" type="integer" length="1" />
    <property name="freezedate" column="fenterprise_freezedate" type="date" length="10" />
    <property name="username" column="fenterprise_username" type="string" not-null="true" length="20" unique="true"/>
    <property name="password" column="fenterprise_password" type="string" not-null="true" length="20"/>
    <property name="email" column="fenterprise_email" type="string" length="50" />
    <property name="tradeCode" column="fenterprise_tradeCode" type="string" length="20" />
    <property name="touchperson" column="fenterprise_touchperson" type="string" length="15" />
    <property name="touchtel" column="fenterprise_touchtel" type="string" length="30" />
    <property name="deptment" column="fenterprise_deptment" type="string" length="30" />
    <property name="enterprisename" column="fenterprise_name" type="string" length="50" />
    <property name="enterpriseaddress" column="fenterprise_address" type="string" length="100" />
    <property name="existencedate" column="fenterprise_date" type="date" length="10" />
    <property name="nuorder" column="fenterprise_nuorder" type="integer" length="10" />
    <property name="product" column="fenterprise_product" type="text" length="1000" />
    <property name="netname" column="fenterprise_netname" type="string" length="50" />
    <property name="introduction" column="fenterprise_intro" type="string" length="255"/>

    <property name="overdate" column="fenterprise_overdate" type="date" length="10" />
    <property name="comdate" column="fenterprise_comdate" type="date" length="10" />
    <property name="regdate" column="fenterprise_regdate" type="date" length="10" />
    <property name="count" column="fenterprise_count" type="integer" length="11" />

    <many-to-one name="groom" column="groom_id" class="EnterpriseGroom" lazy="false"/>
    <many-to-one name="number" column="number_id" class="EnterpriseCommend" lazy="false"/>
    <many-to-one name="nettype" column="nettype_id" class="NetType" lazy="false"/>
    <many-to-one name="provance" column="provance_id" class="Provance" lazy="false"/>
    <many-to-one name="city" column="city_id" class="City" lazy="false"/>
    <many-to-one name="town" column="town_id" class="Town" lazy="false"/>
    <many-to-one name="mosttype" column="mosttype_id" class="MostEnterpriseType" lazy="false"/>
    <many-to-one name="bigtype" column="bigtype_id" class="BigEnterpriseType" lazy="false"/>
    <many-to-one name="type" column="type_id" class="EnterpriseType" lazy="false"/>
    <many-to-one name="domain" column="domain_id" class="EnterpriseDomain" lazy="false"/>
    <many-to-one name="trade" column="trade_id" class="EnterpriseTride" lazy="false"/>
    <many-to-one name="fmosttype" column="fmosttype_id" class="MostEnterpriseType" lazy="false"/>
    <many-to-one name="fbigtype" column="fbigtype_id" class="BigEnterpriseType" lazy="false"/>
    <many-to-one name="ftype" column="ftype_id" class="EnterpriseType" lazy="false"/>
    <many-to-one name="fdomain" column="fdomain_id" class="EnterpriseDomain" lazy="false"/>
    <many-to-one name="ftrade" column="ftrade_id" class="EnterpriseTride" lazy="false"/>

    <set name="brand"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="Brand"/>
    </set>

    <set name="estimate"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="EnterpriseEstimate"/>
    </set>

    <set name="bproduct"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="Bigproduct"/>
    </set>

    <set name="pt"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="Product"/>
    </set>

    <set name="sproduct"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="ServingsProduct"/>
    </set>

    <set name="threefile"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="Tenterpriseuser"/>
    </set>

    <set name="talent"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="NeedTalents"/>
    </set>

    <set name="socialTalent"  inverse="true">
    <key column="fenterprise_id"/>
    <one-to-many class="SocialTalent"/>
    </set>
    </class>
    </hibernate-mapping>
      

  3.   

    java.lang.IllegalArgumentException:   id   to   load   is   required   for   loading 
    出现这种错误是因为SQL查询时,传入的参数(以?形式)为空 
      

  4.   

    最好debug或者System.out.println()下,看看哪个字段是null!
      

  5.   

    java.lang.IllegalArgumentException: id to load is required for loading
     我要遇到了 应该是id 不能 为NULL
      

  6.   

    非常同意很明显啰,SQL没有给id赋值!你肯定是getInformationById(..)...
      

  7.   

    出现该错误可能是运用hibernate的getSession().get(Example.class,id),而传给该方法的id参数为null,会报id to load is required for loading错误