隨筆 - 23  文章 - 3  trackbacks - 0
          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(1)

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          5-8
          昨天晚上我給他講了英文笑話,雖然他指出了很多錯誤,但那是個好的開始。
          ???? A redneck bought a tickect and won the lottery.
          ???? He went to claim it .He said:"I want $20 million right now"
          who verified his tickect number replied to him :"No,sir.It doesn't work this way.we give you $1 million today,you will get the rest spread on for the next 19 years."
          ???? The redneck said:"I want all my money.I won it,and i want it"
          ????? The man had to explained to him patiently:"you would get $1 million,and the rest during the next 19 years."
          ????? The redneck ,furious with the man ,screamed out:"I want all my money.If you don't give??me all my money ,i want my dollar back!"
          注意讀音:money、million、battle zone。

          我的叔叔silas?? H.E.Bates
          ????? 我的叔叔silas??活了九十五歲,有充足的時間去嘗試很多事情.他一度做過掘墓人.
          ????? In a life of 95 years ,my uncle found time to try most things, there was a time he become a gravedigger.
          posted @ 2006-05-09 14:34 aimy 閱讀(110) | 評論 (0)編輯 收藏

          1、get是從服務(wù)器上取得數(shù)據(jù),post是向服務(wù)器上傳送數(shù)據(jù)。
          2、get是將參數(shù)數(shù)據(jù)隊列(表單)加到提交表單的action所指定的url中,值和表單的各個字段是相互對應(yīng)的,Get將表單中數(shù)據(jù)的按照variable=value的形式,添加到action所指向的URL后面,并且兩者使用“?”連接,而各個變量之間使用“&”連接,在url中是可以看見的,
          post是將表單各個字段放在http header內(nèi)一起傳送到action中的URL中,
          3、get,服務(wù)器通過request.getQuery()獲得對應(yīng)的值;對于post,服務(wù)器通過request.getForm()表單的值。
          4、get,傳送的數(shù)據(jù)小,post,傳送的數(shù)據(jù)大,上傳文件一般用post
          特別注意:
          <form action="/GraAppInfo/GraAppInfo.do?method=UpList"? method="post">
          <select name="srchType">
          ???? <option value="0">名字</option>
          ???? <option value="1">用人單位</option>
          ???</select>
          ???<input height="18" name="srchEdit" type="text" align="right">
          ? <input? type="submit" value="查詢">

          顯示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?method=UpList
          <form action="/GraAppInfo/GraAppInfo.do?method=UpList"? method="get">
          顯示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?srchType=0&srchEdit=da
          可見post 會覆蓋action中的參數(shù),
          5、中文用post傳遞不會出現(xiàn)亂碼,用get傳遞會出現(xiàn)亂碼
          所以傳到action后要通過
          String srchEdit = new String(graForm.getSrchEdit().getBytes("iso8859-1"), "gb2312");
          處理。
          二、傳到頁面的值亂碼

          posted @ 2006-05-08 09:50 aimy 閱讀(221) | 評論 (0)編輯 收藏
          <props>
          ??????? <prop key="add*">PROPAGATION_REQUIRED</prop>
          ??????? <prop key="cancel*">PROPAGATION_REQUIRED</prop>
          ??????? <prop key="create*">PROPAGATION_REQUIRED</prop>
          ??????? <prop key="save*">PROPAGATION_REQUIRED</prop>
          </props>
          如果service層沒有用這些字母開頭命名,spring自動將它處理為默認的訪問模式--PROPAGATION_REQUIRED,readOnly
          如果在action直接調(diào)用dao層也不行,比如service.getbaseDAO.update(object)也會出現(xiàn)類似的錯誤,因為事務(wù)被攔截了,所以dao層的方法最好用protect,這樣只有同一個包里的類可以調(diào)用它的方法。
          posted @ 2006-04-30 14:37 aimy 閱讀(86) | 評論 (0)編輯 收藏

          MENUID?UPMENUID?MENUNAME?MENUURL?MENUSEQ?LAYERLEVEL?RIGHTCODE?ISSHOW?TABLETYPE?STARTSTATE
          ?
          ?1083?1001?畢業(yè)生招聘?#?1?1?1083?1??
          ?1084?1083?畢業(yè)生申報?/GraAppInfo/GraAppInfo.do?method=graappinfolist?6?9?1084?1??

          menuid 該層菜單的id ?upmenuid 上一層菜單id? menuname 菜單名字
          menuurl 該層菜單的地址(首層菜單為#,沒有地址)
          menuseq 該層菜單在上一層菜單的順序
          layerlevel 如果是最后一層的菜單為9,其他為1
          rigntcode關(guān)聯(lián)到權(quán)限表=menuid
          idshow 是否顯示

          權(quán)限表:
          RIGHTID?RIGHTCODE?ROLETYPE?ROLEID?DEPTID?USERID?MENUID?FUNNAME
          1084??????????????? 1084????????????? 2????????????????????2??????????????????
          ?????????????????????0??????? 0??????????? 1084?????????? 畢業(yè)生申報
          rightid=menuid=rightcode,roletype,roleid

          這是單位的菜單設(shè)置和權(quán)限設(shè)置(1000〈menuid〈2000)

          2、人事單位內(nèi)部的設(shè)置(4000〈munuid〈5000)
          權(quán)限的設(shè)置通過頁面來控制

          posted @ 2006-04-30 11:19 aimy 閱讀(147) | 評論 (0)編輯 收藏
          為了在每個dao和service 類都能用到log,在basedaoimpl和baseserviceimpl都實現(xiàn)方法:
          ??? public Log getLogger() {
          ??????? if (log == null) {
          ??????????? log = LogFactory.getLog(this.getClass());
          ??????? }
          ??????? return log;
          ??? }

          在類中就可以調(diào)用log
          this.getLogger

          2、<input type="text" name="password">
          與form的屬性對應(yīng),password是大小分別。
          posted @ 2006-04-25 18:07 aimy 閱讀(129) | 評論 (0)編輯 收藏

          public class EmployUnitBaseInfo
          {???
          ?
          ??? private long ID; //用人單位系統(tǒng)編號---邏輯主鍵
          ??? private String unitCode; //用人單位代號--業(yè)務(wù)主鍵
          }
          1、??? 使用邏輯主鍵,分頁比較方便
          2、??? 有可能unitcode會改變,用id可以保證當(dāng)unitcode改變時,這個實體還存在

          {C5A4CCF8-A282-4700-A5F3-FA6A5246D9F2}0.jpg

          在頁面上必須返回workpost + demandid,,
          pojo 中的demand類如下:只有以下屬性的setter和getter
          ??? private String usedNeedNum;
          ??? private int unitId;
          ??? private String demandInfo;
           private long ID;
          ??? private String needNum;
          ??? private String position;
          必須再添加一個屬性demandInfo,
          而在另一個畢業(yè)生申報中又要如圖上操作,,如何在service層向頁面層傳遞這些信息(測試程序員(剩2需求數(shù)))
           public class DemandServiceImpl
          ??? extends BaseServiceImpl implements DemandService{
          ??? public List getDemandList(int unitId)
          ??? {
          ????????? long demandId;
          ????????? int needNum;
          ????????? int usedNeedNum;
          ????????? int lastNum;
          ?????????
          ????????? String demandInfo;
          ????????? TRealDemandDAOImpl dao = (TRealDemandDAOImpl) this.getBaseDAO();
          ????????? List list = dao.getSpareDemandByUnitId(unitId);
          ????????? Iterator it = list.iterator();
          ????????? while(it.hasNext())
          ????????? {
          ????????????? TRealDemand demand = (TRealDemand) it.next();
          ????????????? demandId = demand.getID();
          ????????????? needNum =? Integer.parseInt(demand.getNeedNum());?
          ????????????? usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
          ????????????? if(needNum>usedNeedNum)
          ????????????? {
          ????????????????? lastNum = usedNeedNum-needNum;
          ????????????????? demandInfo = demand.getPosition()+" 剩 " + lastNum +" 需求數(shù) ";
          ????????????? }
          ?????????????
          ????????? }
          ????????? return list;
          ??? }
          }

          在action層再通過以下代碼向頁面?zhèn)鬟f數(shù)據(jù):

          DemandService demandService = (DemandService) this.getBean("DemandService");
          ?request.setAttribute("demandList",demandService.findDemandListByUnitId(unitInfo.getID()));



          4、注意DemandServiceImpl 是實現(xiàn)類,DemandService 是interface
          DemandService demandService = (DemandService) this.getBean("DemandService");
          和DemandServiceImpl demandService = (DemandServiceImpl) this.getBean("DemandService");

          雖然兩個的操作一樣,但是demandService是接口但可以執(zhí)行相應(yīng)的操作,起到黑箱子的作用。

          5、記得在action中添加一個實體時,要通過idcard取得sex和birthday的屬性加到內(nèi)存中(表相對應(yīng)的pojo)

          posted @ 2006-04-21 10:36 aimy 閱讀(101) | 評論 (0)編輯 收藏
          ?String mSqlStr = " SELECT ";
          ??mSqlStr += " UnitName, ";
          ??mSqlStr += " FSUName, FSUPostNumber, FSUAddress ";
          ??mSqlStr += " FROM xmpi.v_UnitInfoAll ";
          ???mSqlStr += " WHERE UnitCode = '" + s_sUserName + "'";?
          ??
          ??? 如果s_sUserName="hello",則" WHERE UnitCode = '" + s_sUserName + "'"就相當(dāng)于" WHERE UnitCode = '" +?"hello" + "'" ,? 最后等于" WHERE UnitCode = ' hello';

          1、value="<logic:notEmpty name="IDCardNo"><bean:write name="IDCardNo"/></logic:notEmpty>"
          ????? 如果直接用value="<%=IDCardNo%>",當(dāng)IDCardNo為null時,頁面會出錯。而logic:notEmpty表示不為空時,才執(zhí)行note中間的代碼。
          2、<logic:iterate id="nation" name="nationList" >
          ???? <option value="<bean:write name="nation" property="codeID"/>"><bean:write name="nation" property="codeName"/></option>
          ??? </logic:iterate>
          表示一組循環(huán),每次循環(huán)都從list nationlist(name="nationList")中取出一個個體nation(id="nation")
          注意:當(dāng)IDCardNo為string,只要指明name屬性(name="IDCardNo"),當(dāng)nation為對象,不僅要指明object名(name="nation" ),還要指明這個對象內(nèi)的屬性(property="codeID")

          3、在serviceimpl層通過 PersonnelDAO dao = (PersonnelDAO)this.getBaseDAO()取得dao類操作,在action層PersonnelService service = (PersonnelService)this.getBean("personnelService")取得serviceimpl類,,同樣在application中設(shè)置為什么方法不一樣??

          4、單個條件查詢
          ????? string id;
          ????? string hql =?new String(" from??PersonnelBaseInfo??where idCardNO=?");
          ????? Object[] object = new Object[] {id}
          ???????this.getHIbernateTemplate().find(hql,object);

          ???? 多個條件查詢
          ????? string id,name;
          ????? string hql =?new String(" from??PersonnelBaseInfo??where id=?&&name=?");
          ?? ?? Object[] object = new Object[] {id,name}
          ???? //object[0]=id;
          ???? //object[1]=name
          ????? this.getHIbernateTemplate().find(hql,object);

          5、記得研究jslib.jsp中的getBaseCode??

          6、不用身份證做TGraAppInfo主鍵的原因是有可能兩家公司同時抱同一個人,,但審核只能通過一份。

          7,pojo與actionform的不同:pojo中對應(yīng)于數(shù)據(jù)庫外鍵的屬性,實體來表示;比如表user內(nèi)有一個字段為studentid,則pojo--userinfo中有一個屬性為student。
          而對應(yīng)于web頁面有一個類為userform,有一個屬性為long。

          8。dto與pojo類的不同
          ????? dto是中間傳遞類,是用來封裝參數(shù)的類,比如將查詢條件太多,則封裝成一個dto


          9。import com.xindeco.business.IEmployUnitData;==相當(dāng)于現(xiàn)在系統(tǒng)的service
          import com.xindeco.business.employunitdata.EmployUnitAPI;相當(dāng)于現(xiàn)在系統(tǒng)的serviceimpl
          import com.xindeco.business.employunitdata.EmployUnitBaseInfoVO;//相當(dāng)于現(xiàn)在系統(tǒng)的pojo

          10 codeApi類
          ??? ??? codeApi.findCodeInfoByCodeID(sexID).getCodeName()
          ???? 根據(jù)codeid查找一行記錄;
          ?????????codeApi.findCodeList(BaseCodeConstants.CODETYPE_NATION)
          ???? 根據(jù)codetypeid查找一串記錄;
          ???????? tcode的表結(jié)構(gòu)為
          ???????CODEID?????? ?CODETYPEID????? CODEVALU?????? ?CODENAME?????? ?ACTIVE?
          比如:????? 1???????????? ???????????1????????????????????????1?????????????????????????????男????????????????? ? 1
          CODECOMPAREVALUE????????? UPCODEID???
          ????????????????? 1????????????????????????????????????? 0
          ???????? tcodetype的表結(jié)構(gòu)為:

          ?? CODETYPEID????? CODETYPENAME
          ????????????? ?1???????????????????? ? ?性別?
          ????
          ????學(xué)制:? CODETYPE_EDUSYSTME??? 培養(yǎng)方式:CODETYPE_UNITGRADE???? 五大生: CODETYPE_RECRUITTARGET
          posted @ 2006-04-19 16:56 aimy 閱讀(169) | 評論 (0)編輯 收藏
          <hibernate-mapping>
          <class
          name="org.hibernate.sample.TUser"
          table="t_user"
          dynamic-update="true"
          dynamic-insert="true"
          >
          ……
          <set
          name="addresses"
          table="t_address"
          lazy="false"?? \\延遲加載,當(dāng)映射到對應(yīng)的pojo時,沒有加載到addresses對應(yīng)的屬性,通過Taddress.getAddress()取不到值,而且特別注意當(dāng)session一關(guān)閉時,就取不到了
          inverse="false" \\反轉(zhuǎn)控制,當(dāng)inverse="true"時,時通過被控方address.setUer()來維系他們之間的關(guān)系.
          cascade="all"?
          sort="unsorted"?? \\是否排序
          order-by="zipcode asc"? \\以什么方式排序
          >
          <key
          column="user_id"
          >
          </key>? \\外鍵
          <one-to-many
          class="org.hibernate.sample.TAddress"
          />
          </set>
          ……
          </class>
          posted @ 2006-04-19 10:37 aimy 閱讀(232) | 評論 (0)編輯 收藏
          1.注意安裝程序的時候要改變log文件的目錄,在log4j.properties中l(wèi)og4j.appender.R.File=E:\\NewFroject\\JmrlProject\\06.NewSourceCode\\newJmrl\\webapp\\WEB-INF\\classes\\jmrl.log
          2、開始一個新的項目,必須重新設(shè)置tomcat,否則tomcat可能老是啟動原來的項目
          3、開始一個新的webapp要把webapp-->properties--->build-->build app archive 設(shè)為never ,還有build app?directory為never這樣可以加快編譯的過程.
          ??????
          posted @ 2006-04-17 17:05 aimy 閱讀(97) | 評論 (0)編輯 收藏

          1、
          org.springframework.orm.ObjectRetrievalFailureException: Object of class [com.xindeco.myregister.pojo.MyRegisterInfo] with identifier [14]: not found
          MyRegisterInfo在數(shù)據(jù)庫沒有identifier [14]對象。


          2、
          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.xindeco.myregister.pojo.MyRegisterInfo column: password (should be mapped with insert="false" update="false")

          出錯原因:password 和repassword同時對應(yīng)數(shù)據(jù)庫表中的password一列,同時update和insert都設(shè)為true。
          xml文件如下:
          ??? <property name="password"
          ????????????????????????? type="java.lang.String"
          ????????????????????????? update="true"
          ????????????????????????? insert="true"
          ????????????????????????? access="property"
          ????????????????????????? column="password"
          ????????????????????????? length = "32"
          ????????????????????????? />

          ???????????????????????? <property name="repassword"
          ????????????????????????? type="java.lang.String"
          ????????????????????????? update="false"
          ????????????????????????? insert="false"
          ????????????????????????? access="property"
          ????????????????????????? column="password"
          ????????????????????????? length = "32"
          ????????????????????????? />
          解決的方法:
          將repassword的insert和update設(shè)為false。


          3、
          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed;
          nested exception is org.hibernate.PropertyNotFoundException: Could not find a getter for ID in class

          錯誤原因:hibernate的映射文件中ID是大寫的,而pojo的類中id是小寫的

          注意事項:每個pojo的類都要繼承abstractEntity,其中abstractEntity類有個ID的屬性要重寫
          ?public abstract class AbstractEntity
          ??? implements Entity, BaseDTO {

          ??? abstract public long getID();

          ??? abstract public void setID(long id);

          ??? public int hashCode() {
          ??????? return (int)this.getID();
          ??? }

          ??? public boolean equals(Object obj) {
          ??????? if (obj == this) {
          ??????????? return true;
          ??????? }
          ??????? if (obj instanceof Entity) {
          ??????????? return this.getID() == ( (Entity) obj).getID();
          ??????? }
          ??????? return false;
          ??? }
          }

          4、
          org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition

          錯誤原因:
          在application.xml文件中deleteRegister方法以delete開頭,并沒有被設(shè)定為可更改的,應(yīng)如下設(shè)置:
          ?<!--為事物創(chuàng)建代理類,并指定方法的事物類型-->
          ? <bean id="baseTxProxy" lazy-init="true" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
          ??? <property name="transactionManager">
          ????? <ref bean="transactionManager"/>
          ??? </property>
          ??? <property name="transactionAttributes">
          ????? <props>
          ??????? <prop key="add*">PROPAGATION_REQUIRED</prop>
          ??????? <prop key="cancel*">PROPAGATION_REQUIRED</prop>
          ???????????</props>
          ??? </property>
          ? </bean>
          加上一行
          ? <prop key="delete*">PROPAGATION_REQUIRED</prop>

          5、
          ???ERROR org.apache.struts.util.RequestUtils - Error creating form bean of class com.xindeco.business.web.form.GraAppInfoForm

          public class? GraAppInfoForm
          extends ActionForm 錯誤寫成
          public abstratic?class? GraAppInfoForm
          extends ActionForm

          6、
          2006-04-25 08:56:38,495 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@8e2fb5
          java.lang.ClassCastException: $Proxy0
          ?at com.xindeco.business.web.action.GraAppAction.newone(GraAppAction.java:30)
          ?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          ?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          ?at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          ?at java.lang.reflect.Method.invoke(Method.java:585)
          ?at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
          ?at com.xindeco.core.web.action.BaseAction.dispatchMethod(BaseAction.java:153)
          ?at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)


          actioin類中的newone方法如下:
          public? class GraAppAction
          ??? extends BaseAction {
          ??? public ActionForward newone(ActionMapping mapping, ActionForm form,
          ????????????????????????????? HttpServletRequest request,
          ????????????????????????????? HttpServletResponse response) throws Exception {
          ???????GraAppService ?graservice = (GraAppService) this.getBean("GraAppService");
          }

          applicationcontext中的GraAppService的配置如下:
          ??? <bean id="GraAppDAO" class="com.xindeco.business.dao.impl.GraAppDAOImpl">
          ??? <property name="support">
          ????? <ref local="support"/>
          ??? </property>
          ??? <property name="sessionFactory">
          ????? <ref local="sessionFactory"/>
          ??? </property>
          ? </bean>
          ? <bean id="GraAppService" parent="baseTxProxy">
          ??? <property name="target">
          ????? <bean class="com.xindeco.business.service.impl.GraAppServiceImpl" autowire="byName">
          ??????? <property name="baseDAO">
          ????????? <ref bean="GraAppDAO"/>
          ??????? </property>
          ????? </bean>
          ??? </property>
          ? </bean>

          因此this.getBean("GraAppService");是為了得到GraAppServicImpl類的實現(xiàn)。GraAppService是interface
          public class GraAppServiceImpl extends BaseServiceImpl
          ??? implements GraAppService{
          }

          7、org.hibernate.hql.ast.QuerySyntaxException: Demand is not mapped. [from Demand where unitid = ? and needNum > usedNeedNum]

          hibernate.cfg.xml沒有配置Demand.hbm.xml文件的目錄

          8、org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 列名 'id' 無效。
          java.sql.SQLException: 列名 'name' 無效。

          因為hibernate聲明的id,name的columnid屬性沒有與數(shù)據(jù)庫的字段對應(yīng),所以id,name無效。


          9、java.lang.NumberFormatException: null
          ?at java.lang.Integer.parseInt(Integer.java:415)
          ?at java.lang.Integer.parseInt(Integer.java:497)
          ?at com.xindeco.business.service.impl.DemandServiceImpl.findDemandListByUnitId(DemandServiceImpl.java:33)

          錯誤語句為
          ?needNum = Integer.parseInt(demand.getNeedNum());
          ?usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
          因為demand.getUsedNeedNum()==null,無法轉(zhuǎn)化為string 類型,

          10、rg.apache.jasper.JasperException: /GraAppInfo/GraAppInfoNew.jsp(343,29) According to TLD, tag bean:write must be empty, but is not

          錯誤的原因:
          ????????????? <select name="politicsID" >
          ??????????? ?<option value="">請選擇</option>
          ?????? <logic:notEmpty name="politicsList">
          ??????????????? <logic:iterate id="politics" name="politicsList">
          ????????????????????????? </logic:notEmpty>
          ???????????<option value="<bean:write name="politics" property="codeID"/>"><bean:write name="politics" property="codeName"/></option>
          ????????? </logic:iterate>
          ?</select>
          就因為少了/>
          以后懂得通過查找字數(shù),來檢查錯誤


          11、2006-04-26 13:27:54,812 ERROR com.xindeco.core.util.BeanUtils - bean property [Nation] copy failed
          com.xindeco.core.exception.ConvertException: org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.lang.String; nested exception is org.hibernate.MappingException: Unknown entity: java.lang.String

          beanUtil.beanCopy(grapojo,form,BizConstants.CONVERTER);
          要求:
          1、pojo類的屬性只有與form屬性名字相同,才能beancopy成功
          2、pojo中屬性是實體,在form中一定要用int,long表示
          出現(xiàn)這錯誤的原因是pojo中的屬性不是實體,而錯誤寫成:
          string
          ?private String nation;應(yīng)改成 private?Syscode nation;

          12、
          2006-04-26 14:38:37,843 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@fa1b2d
          java.lang.NullPointerException
          ?at com.xindeco.business.web.action.GraAppAction.newone(GraAppAction.java:43)
          ?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          ?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          hibernate配置文件沒改,程序找不到相應(yīng)的類
          ??????? <many-to-one
          ??????????? name="FSUnit"
          ??????????? class="com.xindeco.business.pojo.EmployUnitBaseInfo"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="fSUnit"
          ??????? />

          其實FSUnit對應(yīng)的類應(yīng)該是FSUnit
          ??????? <many-to-one
          ??????????? name="FSUnit"
          ??????????? class="com.xindeco.business.pojo.FSUnit"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="fSUnit"
          ??????? />

          13、
          org.hibernate.MappingException: An association from the table GraAppInfo refers to an unmapped class: com.xindeco.business.pojo.FSUnit

          錯誤原因:hibernate.cfg.xml沒有配置fsunit.hbm.xml文件的位置

          14、
          java.lang.ClassCastException: com.xindeco.business.dao.impl.GraAppDAOImpl
          at com.xindeco.business.service.impl.GraAppServiceImpl.addGraduateApp(GraAppServiceImpl.java:16)
          GraAppServiceImpl.java:16
          第16行: GraAppDAO dao = (GraAppDAO) this.getBaseDAO();//其實得到的是GraAppDAOImpl

          錯誤的原因是
          public class GraAppDAOImpl
          ??? extends BaseDAOImpl {

          }
          沒有實現(xiàn)GraAppDAO接口,正確的做法是
          public class GraAppDAOImpl
          ??? extends BaseDAOImpl implements GraAppDAO {
          }
          先繼承后實現(xiàn)


          15、2006-04-27 08:38:54,078 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@1d6399b
          java.lang.ClassCastException: com.xindeco.business.pojo.SysCode
          ?at org.hibernate.type.StringType.set(StringType.java:26)
          ?at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:63)
          ?at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:40)

          一般是因為hibernate聲明類型和pojo類聲明的類型不一樣,并且前面已經(jīng)出現(xiàn)了Hibernate: insert into TGraAppInfo (name, whereFrom, degree, college, speciality, studentRelTel, remark, higherEduLength, highSchool, studyResume, normalOrNot, proxyUnit, workPost, workPlace, studentAddress, studentPostNumber, nation, appStatus) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
          的操作提示,查出錯誤的原因有:
          ??????? <many-to-one
          ??????????? name="demand"
          ??????????? class="com.xindeco.business.pojo.Syscode"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="demandID"
          ??????? />
          ???????? <property
          ??????????? name="appStatus"
          ??????????? type="int"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="appStatus"
          ??????????? length="10"
          ??????? />
          應(yīng)改為????
          ??????? <many-to-one
          ??????????? name="demand"
          ??????????? class="com.xindeco.business.pojo.Demand"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="demandID"
          ??????? />

          ??<many-to-one
          ??????????? name="nation"
          ??????????? class="com.xindeco.business.pojo.SysCode"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="nation"
          ??????? />

          16、
          org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.xindeco.business.pojo.SysCode
          ?at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:626)
          ?at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:570)
          ?at
          org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:482)




          pojo類為:
          public class GraAppInfo{
          ???????????? private College college;
          }

          action 類為
          public class GraAppAction
          ??? extends BaseAction {
          ?????? public ActionForward add(ActionMapping mapping, ActionForm form,
          ???????????????????????????? HttpServletRequest request,
          ???????????????????????????? HttpServletResponse response) throws Exception {

          ????????graInfo.setCollege(new College());\\必須從數(shù)據(jù)庫找到college這個對象,而不能新生成
          ???????
          ??????? graInfo.getCollege().setID(graForm.getCollegeID());
          ??????? graInfo.setAppStatus(Integer.parseInt("0"));
          ??????service.addGraduateApp(graInfo);
          }

          public class GraAppServiceImpl extends BaseServiceImpl
          ??? implements GraAppService{

          ??? public boolean addGraduateApp(GraAppInfo info)
          ??? {
          ??????? this.getBaseDAO().save(info);
          ??????? return true;
          ??? }
          }
          dao類save方法為
          ??? getHibernateTemplate().save(obj);

          當(dāng)cascade="all",插入new college 除了id和原來的記錄一樣,其他的字段全部都被更新,為null
          當(dāng)cascase=“insert”,插入new college 只會把它的id插入grainfo表中,其他字段不變。

          17、java.sql.SQLException: Unable to convert between java.lang.Integer and BLOB.
          因為
          ??????? <property
          ??????????? name="province"
          ??????????? type="com.xindeco.business.pojo.SysCode"http://不能用復(fù)雜類,
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="provinceId"
          ??????? />
          應(yīng)該改為
          ??? ??????? <many-to-one
          ??????????? name="province"
          ??????????? class="com.xindeco.business.pojo.SysCode"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="provinceId"
          ??????? />

          18、javax.servlet.jsp.JspException: Cannot create iterator for this collection
          ?at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:265)
          jsp文件如下:
          ? ?<logic:notEmpty name="graduateList" >
          ? ?<logic:iterate id="graduate"? name="graduateList" >
          ?? </ogic:notEmpty >
          ?? </ogic:iterat>
          graduateList是一個類,而logic:iterator要求必須是ArrayList,HashSet....這樣的集合類,而graduateList中一個屬性是ArrayList或HashSet的
          應(yīng)改為:
          <logic:notEmpty name="graduateList" property="items">
          ?<logic:iterate id="graduate"? name="graduateList" property="items" >
          ?</ogic:notEmpty >
          ??</ogic:iterat>


          19、2006-05-11 17:13:37,468 ERROR com.xindeco.business.web.action.GraAppAction - com.xindeco.business.web.action.GraAppAction@bc22eb
          org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed

          SysUser user= (SysUser) request.getSession().getAttribute(WebConstants.SESSION_USER);
          ??????? System.out.println(user.getRole().getRoleName());
          當(dāng)hibernate session取出數(shù)據(jù)放到http session時,
          由于sysuser中role的lazy=“true”,所以沒有將RoleName放到http session中,當(dāng)System.out.println(user.getRole().getRoleName());
          時,雖然http session還開著, hibernat seesion已經(jīng)關(guān)閉
          ??????? <many-to-one
          ??????????? name="role"
          ??????????? class="com.xindeco.business.pojo.SysRole"
          ??????????? lazy="false"
          ??????????? cascade="none"
          ??????????? outer-join="auto"
          ??????????? update="true"
          ??????????? insert="true"
          ??????????? access="property"
          ??????????? column="roleID"
          ??????? />
          20、Association references unmapped class: com.xindeco.workflow.WFNode
          因為application.xml文件中沒有配置<mapping resource="com/xindeco/workflow/WFNode.hbm.xml"/>
          系統(tǒng)找不到WFNode

          ??????? < set
          ????????????name
          = " nodes "
          ????????????table
          = " WF_ROLENODES "
          ????????????lazy
          = " true "
          ????????????inverse
          = " false "
          ????????????cascade
          = " none "
          ????????????sort
          = " unsorted "
          ????????
          >

          ??????????????
          < key
          ??????????????????column
          = " roleID "
          ??????????????
          >
          ??????????????
          </ key >

          ?????????????????
          < many - to - many
          ??????????????????
          class = " com.xindeco.workflow.WFNode "
          ??????????????????column
          = " nodeId "
          ??????????????????outer
          - join = " auto "
          ???????????????
          />
          ???????????????

          ????????
          </ set >
          posted @ 2006-04-16 15:54 aimy 閱讀(2713) | 評論 (1)編輯 收藏
          僅列出標(biāo)題
          共3頁: 上一頁 1 2 3 下一頁 
          主站蜘蛛池模板: 澄城县| 华阴市| 汝州市| 绵阳市| 丁青县| 云浮市| 宜章县| 泾源县| 宁阳县| 内丘县| 长寿区| 巴楚县| 梅州市| 得荣县| 宜宾市| 九龙城区| 手机| 汉沽区| 泰州市| 庄河市| 辽阳县| 青岛市| 和龙市| 临汾市| 宁陕县| 蕲春县| 广德县| 历史| 洛宁县| 延庆县| 汝南县| 河北区| 庆云县| 维西| 九龙坡区| 壶关县| 温州市| 双流县| 贡嘎县| 阿合奇县| 车险|