隨筆 - 23  文章 - 3  trackbacks - 0
          <2006年6月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          常用鏈接

          留言簿(1)

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

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

          ????????????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 閱讀(221) | 評論 (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中已經手動刪除了id=‘82’的記錄,而在WF_task以及wf-proces中還有bizclass = '3' && bizId = '82'的記錄,只要刪除wf-task中相應的記錄.
          posted @ 2006-07-09 16:17 aimy 閱讀(232) | 評論 (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>

          數據庫的數據:
          ???? 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,通過構造函數創建bean
          ?<bean?id="baseDAO"?class="com.aimy.core.dao.impl.BaseDAOImpl">
          相當于
          basedaoimpl?baseDAO?
          =?new?BaseDAOImpl();
          2,通過靜態工廠創建bean
          <bean?id="driver1"?class="com.aimy.driver.driverManager"
          factory
          -method="createInstance"/>
          相當于
          Object?driver1?
          =?driverManager.createInstance();

          其中沒有指定driverManager.createInstance();返回對象的類型,而且createInstance()必須是static方法
          3,通過實例工廠方法創建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 保存空值的細節
          1。如果字段在pojo類中是復雜對象類型,則在數據庫用nulll表示。
          2。如果字段在pojo類中是簡單數據類型,則在數據庫用0表示。
          posted @ 2006-06-26 09:56 aimy 閱讀(174) | 評論 (0)編輯 收藏
          主站蜘蛛池模板: 萨迦县| 牡丹江市| 肃宁县| 尼木县| 金华市| 四子王旗| 右玉县| 安陆市| 邯郸县| 石屏县| 福鼎市| 招远市| 武夷山市| 郑州市| 桐城市| 调兵山市| 黑河市| 乌兰察布市| 鹤庆县| 民权县| 天长市| 房山区| 丹巴县| 雷州市| 合肥市| 汽车| 武陟县| 西藏| 东源县| 湖南省| 时尚| 醴陵市| 玉树县| 通城县| 安康市| 五寨县| 池州市| 山东省| 金堂县| 镇雄县| 乐至县|