2008年9月7日

          NonUniqueObjectException

          org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

          首先看看這個(gè)類:
          //$Id: NonUniqueObjectException.java,v 1.4 2005/02/12 07:19:50 steveebersole Exp $
          2
          package org.hibernate;
          3
          4 import java.io.Serializable JavaDoc;
          5
          6 import org.hibernate.pretty.MessageHelper;
          7
          8 /**
          9  * This exception is thrown when an operation would
          10  * break session-scoped identity. This occurs if the
          11  * user tries to associate two different instances of
          12  * the same Java class with a particular identifier,
          13  * in the scope of a single <tt>Session</tt>.
          14  *
          15  * @author Gavin King
          16  */

          17 public class NonUniqueObjectException extends HibernateException {
          18     private final Serializable JavaDoc identifier;
          19     private final String JavaDoc entityName;
          20
          21     public NonUniqueObjectException(String JavaDoc message, Serializable JavaDoc id, String JavaDoc clazz) {
          22         super(message);
          23         this.entityName = clazz;
          24         this.identifier = id;
          25     }
          26
          27     public NonUniqueObjectException(Serializable JavaDoc id, String JavaDoc clazz) {
          28         this("a different object with the same identifier value was already associated with the session", id, clazz);
          29     }
          30
          31     public Serializable JavaDoc getIdentifier() {
          32         return identifier;
          33     }
          34
          35     public String JavaDoc getMessage() {
          36         return super.getMessage() + ": " +
          37             MessageHelper.infoString(entityName, identifier);
          38     }
          39
          40     public String JavaDoc getEntityName() {
          41         return entityName;
          42     }
          43
          44 }


          解決方案:
               this..getSession().clear();

          posted @ 2008-09-25 17:07 bill 閱讀(902) | 評(píng)論 (0)編輯 收藏

          SSH整合中的問(wèn)題

          Error Creating SessionFactory java.lang.SecurityException: class"org.apache.commons.collections.SequencedHashMap"'異常的解決方案

          本人用 MyEclipse 6.0.0 開(kāi)發(fā) Struts + Hibernate應(yīng)用的時(shí)候,單獨(dú)測(cè)試Hibernate的類沒(méi)有問(wèn)題,但是當(dāng)Web層和Struts整合后,就拋出如下異常:
          %%%%Error Creating SessionFactory %%%% java.lang.SecurityException: class"org.apache.commons.collections.SequencedHashMap"'s signer informationdoes not match signer information of other classes in the same package

             原因是myeclipse  6.0的jar包問(wèn)題。這個(gè)是myeclipse沒(méi)有做好嚴(yán)格的測(cè)試。

             網(wǎng)上好多人說(shuō)是commons-collectionsXXX.jar的問(wèn)題。我也不知道。我是把所有的myeclipse生成的jar都remove buildpath 了。
             我又自己添加的jar。就OK!!!!

          posted @ 2008-09-09 21:36 bill 閱讀(234) | 評(píng)論 (0)編輯 收藏

          sql server 2000 安裝掛起問(wèn)題

             sql server 2000 安裝掛起問(wèn)題:
           解決方案:開(kāi)始--->運(yùn)行--->regedit--->HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
             刪除PendingFileRenameOperations

          posted @ 2008-09-07 01:32 bill 閱讀(239) | 評(píng)論 (0)編輯 收藏

          <2008年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(1)

          隨筆分類(2)

          隨筆檔案(4)

          相冊(cè)

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 阿尔山市| 郧西县| 长垣县| 彭阳县| 镇坪县| 沙坪坝区| 依兰县| 江华| 乌拉特后旗| 老河口市| 沙河市| 大庆市| 五台县| 珲春市| 龙川县| 玛纳斯县| 满洲里市| 湘西| 温宿县| 平罗县| 青川县| 鲁山县| 平顺县| 北票市| 邯郸市| 腾冲县| 茶陵县| 页游| 宜兰市| 兴山县| 阿图什市| 哈尔滨市| 冕宁县| 图们市| 古蔺县| 同江市| 岱山县| 通山县| 宜都市| 昆明市| 同德县|