隨筆 - 23  文章 - 3  trackbacks - 0
          <2006年4月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          常用鏈接

          留言簿(1)

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          注意writer的參數(shù)有多個,特別是有一個boolean的參數(shù)決定刷新或在附加文本

          ????????????log? = ?? new ?PrintWriter( new ?FileOutputStream(fl, true ), true );
          ????????????SimpleDateFormat?df?
          = ? new ?SimpleDateFormat( " yyyy.MM.dd?'at'?hh:mm:ss\n "
          );
          ????????????Date?now?
          = ? new
          ?Date();
          ????????????String?dateformat?
          =
          ?df.format(now)
          ????????????BufferedWriter?bf??
          = ? new ?BufferedWriter( new ?FileWriter(fl,? true
          ));
          ????????????bf.append(dateformat);
          ????????????bf.close();
          ????????????log.println(
          " start?connection?databse: "
          );
          ????????????log.println(
          " driver?name: " .concat(driveName);


          輸出的結果示例:
          2006.12.12?at?10:21:13
          start?connection?databse:
          driver?name:oracle.jdbc.driver.OracleDriver

          posted @ 2006-12-12 12:16 aimy 閱讀(222) | 評論 (0)編輯 收藏
          1、org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xindeco.business.pojo.NonageRegister#82]
          ?at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
          ?at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:65)
          ?at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(ApplicationFilterChain.java:252)
          ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          ?at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
          ?at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
          ?at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
          ?at org.apache.catalina.core.ApplicationDispatcher.forward

          錯誤的原因:
          在nonregsiter中已經(jīng)手動刪除了id=‘82’的記錄,而在WF_task以及wf-proces中還有bizclass = '3' && bizId = '82'的記錄,只要刪除wf-task中相應的記錄.
          posted @ 2006-07-09 16:17 aimy 閱讀(233) | 評論 (0)編輯 收藏

          ProcessInstance.hbm.xml:

          <? xml?version = " 1.0 " ?encoding = " UTF-8 " ?>

          <! DOCTYPE?hibernate - mapping?PUBLIC
          ????
          " -//Hibernate/Hibernate?Mapping?DTD?3.0//EN " ?
          ????
          " http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

          < hibernate - mapping
          >
          ????
          < class
          ????????name
          = " com.xindeco.workflow.ProcessInstance "
          ????????table
          = " WF_PROCESS "
          ????????dynamic
          - update = " true "
          ????????dynamic
          - insert = " true "
          ????????select
          - before - update = " false "
          ????????optimistic
          - lock = " version "
          ????
          >

          ????????
          < id
          ????????????name
          = " ID "
          ????????????column
          = " ID "
          ????????????type
          = " long "
          ????????????length
          = " 30 "
          ????????
          >
          ????????????
          < generator? class = " native " >
          ????????????
          </ generator >
          ????????
          </ id >

          ????????
          < discriminator
          ????????????column
          = " bizClass "
          ????????????type
          = " string "
          ????????
          />
          ????????
          ????????
          < property
          ????????????name
          = " state "
          ????????????type
          = " java.lang.Integer "
          ????????????update
          = " true "
          ????????????insert
          = " true "
          ????????????access
          = " property "
          ????????????column
          = " state "
          ????????????length
          = " 10 "
          ????????
          />
          ????????
          ????????
          < many - to - one
          ????????????name
          = " flow "
          ????????????
          class = " com.xindeco.workflow.WFFlow "
          ????????????cascade
          = " none "
          ????????????outer
          - join = " auto "
          ????????????update
          = " true "
          ????????????insert
          = " true "
          ????????????access
          = " property "
          ????????????column
          = " flowId "
          ????????
          />

          ????????
          < set
          ????????????name
          = " tasks "
          ????????????lazy
          = " true "
          ????????????inverse
          = " true "
          ????????????cascade
          = " delete "
          ????????????sort
          = " unsorted "
          ????????
          >

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

          ??????????????
          < one - to - many
          ??????????????????
          class = " com.xindeco.workflow.WFTask "
          ??????????????
          />

          ????????
          </ set >

          ????
          </ class >

          </ hibernate - mapping >

          CollRegPI.hbm.xml:

          <?xml?version="1.0"?>
          <!DOCTYPE?hibernate-mapping?PUBLIC
          ??????
          "-//Hibernate/Hibernate?Mapping?DTD?3.0//EN"
          ??????????
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

          <hibernate-mapping?default-access="field"?>

          ??
          <subclass?name="com.xindeco.business.pojo.wf.CollRegPI"
          ????????????discriminator
          -value="2"
          ????????????
          extends="com.xindeco.workflow.ProcessInstance"
          ????????????lazy
          ="false">

          ????????????
          <many-to-one?name="collReg"
          ?????????????????
          class="com.xindeco.business.pojo.CollReg"
          ?????????????????column
          ="bizId"
          ?????????????????cascade
          ="none"/>
          </subclass>
          </hibernate-mapping>

          數(shù)據(jù)庫的數(shù)據(jù):
          ???? id??? flowid????bizId???bizClass???state
          ??21????? ?2????????? ?9 ???????? 2???????? ???? 0
          ?22???????? 2???????? 10???????? 2???????????? ?0
          ?23???????? 2???????? 11???????? 2??????????????0
          ?24???????? 2???????? 12???????? 2????????????? 0
          ?25???????? 2???????? 13???????? 2????????????? 0
          ?26???????? 2???????? 14???????? 2????????????? 0
          ?29???????? 2???????? 17???????? 2???????????? ?0
          ?30???????? 2???????? 18???????? 2??????????? ? 1
          ?44????? ?? 4?????? ??1?????? ?? 32????? ?????? 0
          ?45????? ?? 4?????? ? 2?????? ??? 32????? ?????? 1
          ?46????? ?? 5??????????1??????????33?????????????0
          ?47?????? ? 5??????????2???????????33?????????????1
          ?48??????? ?5??????????3???????????33????? ?????? 0
          ?50????? ? ?3????????? 1????????????3??????????????0
          ?51????? ? ?3???????? 1????????????3??????????????0

          如果bizclass=2是同一種類型的class。由????????
          ?????????<discriminator
          ????????????column
          ="bizClass"
          ????????????type
          ="string"
          ????????
          />來表示。
          posted @ 2006-07-06 10:37 aimy 閱讀(391) | 評論 (0)編輯 收藏
          org.hibernate.hql.QuerySplitter - no persistent classes found for query class:
          意味著你沒有將someclass的配置文件放在hibernate.config或沒有寫配置文件。
          posted @ 2006-07-04 10:30 aimy 閱讀(1174) | 評論 (0)編輯 收藏
          1,通過構造函數(shù)創(chuàng)建bean
          ?<bean?id="baseDAO"?class="com.aimy.core.dao.impl.BaseDAOImpl">
          相當于
          basedaoimpl?baseDAO?
          =?new?BaseDAOImpl();
          2,通過靜態(tài)工廠創(chuàng)建bean
          <bean?id="driver1"?class="com.aimy.driver.driverManager"
          factory
          -method="createInstance"/>
          相當于
          Object?driver1?
          =?driverManager.createInstance();

          其中沒有指定driverManager.createInstance();返回對象的類型,而且createInstance()必須是static方法
          3,通過實例工廠方法創(chuàng)建bean
          <bean?id="father"?class="com.aimy.Father"/>
          ........
          <bean?id="son"?factory-bean="father"?factory-method="createSon"/>
          相當于
          Father?father?
          =?new?Father();
          Object?son?
          =?father.createSon();

          其中father和son必須在同一個bean工廠或父bean工廠,即在同一個applicationcontext或子applicationcontext


          二、如果applicationcontext默認預實例化那些singleton bean,這樣就可以在beanfactory裝載時就檢查出錯誤,而如果singleton bean設置為lazy-mode,
          posted @ 2006-06-26 23:26 aimy 閱讀(237) | 評論 (0)編輯 收藏
          hibernate 保存空值的細節(jié)
          1。如果字段在pojo類中是復雜對象類型,則在數(shù)據(jù)庫用nulll表示。
          2。如果字段在pojo類中是簡單數(shù)據(jù)類型,則在數(shù)據(jù)庫用0表示。
          posted @ 2006-06-26 09:56 aimy 閱讀(174) | 評論 (0)編輯 收藏
          1. document.name.value----->document.all.name.value
          2. eval(document.all.name)---->eval('document.all.name')
          3.javascript:window.history.go(-1)
          4、在action方法中只要拋出exception,就會跳到jspexception頁面中,怎么處理。
          posted @ 2006-06-22 13:19 aimy 閱讀(193) | 評論 (0)編輯 收藏
          為了將業(yè)務邏輯放到service層,比如判斷登陸用戶的信息,而在service層無法用SysUser user = (SysUser) request.getSession().getAttribute(WebConstants.SESSION_USER);因此在BaseService設一個屬性為
          ??????public void setOperator(Entity operator);
          ??????public Entity getOperator();
          posted @ 2006-05-17 11:17 aimy 閱讀(298) | 評論 (0)編輯 收藏
          ???private static WFEngine instance;
          ??? public static final WFEngine getInstance() {
          ??????? return instance;
          ??? }
          posted @ 2006-05-17 10:05 aimy 閱讀(199) | 評論 (0)編輯 收藏

          <sqlMap namespace="PersonnelRegist">

          ? <typeAlias alias="ID" type="com.xindeco.core.pojo.IDEntity"/>
          ? </select>
          ?? <select id="GraAppInfo.searchUpApply" parameterClass="com.xindeco.business.dto.GraAppInfoDTO"????resultClass="ID" cacheModel="userCache">
          ?? select distinct a.ID AS id
          ?? from TGraAppInfo a? left join TEMPLOYUNITBASEINFO b on a.unit=b.MEMBERID
          ?? where appstatus = '1'
          ?? <dynamic>
          ?? <isNotEmpty prepend="AND" property="name">(a.name like '%' + #name# + '%')</isNotEmpty>
          ?? <isNotEmpty prepend="AND" property="unit">(b.UNITNAME like '%' + #unit# + '%')</isNotEmpty>
          ?? </dynamic>
          ? </select>
          </sqlMap>

          注意sqlmapGraAppInfoDTO的name,unit只能是基本數(shù)據(jù)類型,不能是復雜數(shù)據(jù)類型.
          2、<script>的位置
          <script>
          form1.srchEdit.value='<%=srchEdit%>';
          form1.srchType.value='<%=srchType%>';????
          </script>
          <form>
          <input type="text" name="srchEdit"/>
          <input type="text" name="srchType"/></form>
          與<form>
          <input type="text" name="srchEdit"/>
          <input type="text" name="srchType"/>
          </form>
          <script>
          form1.srchEdit.value='<%=srchEdit%>';
          form1.srchType.value='<%=srchType%>';????
          </script>
          的差別,必須在form加載完對它賦值,否則srchEdit又重新加載,為null

          3、hibernate屬性設置出現(xiàn)錯誤:
          ????? 如果pojo類取fSUnit屬性名,系統(tǒng)將無法識別。get和set將取不到值。

          posted @ 2006-05-11 10:06 aimy 閱讀(313) | 評論 (0)編輯 收藏
          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是從服務器上取得數(shù)據(jù),post是向服務器上傳送數(shù)據(jù)。
          2、get是將參數(shù)數(shù)據(jù)隊列(表單)加到提交表單的action所指定的url中,值和表單的各個字段是相互對應的,Get將表單中數(shù)據(jù)的按照variable=value的形式,添加到action所指向的URL后面,并且兩者使用“?”連接,而各個變量之間使用“&”連接,在url中是可以看見的,
          post是將表單各個字段放在http header內一起傳送到action中的URL中,
          3、get,服務器通過request.getQuery()獲得對應的值;對于post,服務器通過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 閱讀(218) | 評論 (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直接調用dao層也不行,比如service.getbaseDAO.update(object)也會出現(xiàn)類似的錯誤,因為事務被攔截了,所以dao層的方法最好用protect,這樣只有同一個包里的類可以調用它的方法。
          posted @ 2006-04-30 14:37 aimy 閱讀(85) | 評論 (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關聯(lián)到權限表=menuid
          idshow 是否顯示

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

          這是單位的菜單設置和權限設置(1000〈menuid〈2000)

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

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

          在類中就可以調用log
          this.getLogger

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

          public class EmployUnitBaseInfo
          {???
          ?
          ??? private long ID; //用人單位系統(tǒng)編號---邏輯主鍵
          ??? private String unitCode; //用人單位代號--業(yè)務主鍵
          }
          1、??? 使用邏輯主鍵,分頁比較方便
          2、??? 有可能unitcode會改變,用id可以保證當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í)行相應的操作,起到黑箱子的作用。

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

          posted @ 2006-04-21 10:36 aimy 閱讀(100) | 評論 (0)編輯 收藏
          主站蜘蛛池模板: 齐河县| 巴楚县| 会泽县| 会宁县| 鹤峰县| 准格尔旗| 应用必备| 荣成市| 德阳市| 满洲里市| 开封县| 博野县| 洪泽县| 江安县| 天柱县| 崇州市| 白朗县| 印江| 荃湾区| 长阳| 新竹县| 弥渡县| 洪湖市| 潞城市| 元江| 资源县| 濮阳县| 盘锦市| 同江市| 西青区| 荥阳市| 扎囊县| 厦门市| 康马县| 霍林郭勒市| 历史| 新巴尔虎左旗| 任丘市| 莱州市| 黄梅县| 三亚市|