VIRGIN FOREST OF JAVA
          不要埋頭苦干,要學習,學習,再學習。。。。。
          powered by R.Zeus

          ??????? Configuration configuration=null;
          ??????? try {
          ??????????? Configuration configurationSerializable = new Configuration();
          ??????????? FileOutputStream fos = new FileOutputStream("serial");
          ??????????? ObjectOutputStream oos = new ObjectOutputStream(fos);
          ??????????? oos.writeObject(configurationSerializable);
          ??????????? oos.flush();
          ??????????? oos.close();
          ??????? } catch (FileNotFoundException e) {
          ??????????? e.printStackTrace();? //To change body of catch statement use File | Settings | File Templates.
          ??????? }
          ??????? catch (IOException e) {
          ??????????? e.printStackTrace();? //To change body of catch statement use File | Settings | File Templates.
          ??????? }

          ??????? try {
          ??????????? FileInputStream fis = new FileInputStream("serial");
          ??????????? ObjectInputStream ois = new ObjectInputStream(fis);
          ??????????? configuration = (Configuration) ois.readObject();
          ??????????? ois.close();
          ??????? } catch (FileNotFoundException e) {
          ??????????? e.printStackTrace();? //To change body of catch statement use File | Settings | File Templates.
          ??????? }
          ??????? catch (IOException e) {
          ??????????? e.printStackTrace();? //To change body of catch statement use File | Settings | File Templates.
          ??????? }
          ??????? catch (ClassNotFoundException e) {
          ??????????? e.printStackTrace();? //To change body of catch statement use File | Settings | File Templates.
          ??????? }
          ??????? if(configuration!=null)
          ??????? {
          ??????? SessionFactory sessionFactory = configuration.configure().buildSessionFactory();
          ??????? Session session = sessionFactory.openSession();
          ??????? Transaction transaction = session.beginTransaction();
          ??????? callBack.doing(session);
          ??????? transaction.commit();
          ??????? }
          ??? }
          when will Configuration serialize and why it's some field seted transient?the example will be error because some field transient is null after serialize.

          posted on 2006-10-30 16:40 R.Zeus 閱讀(367) 評論(0)  編輯  收藏 所屬分類: HibernateJ2SE
          主站蜘蛛池模板: 稷山县| 霸州市| 富裕县| 嘉定区| 调兵山市| 工布江达县| 汽车| 宁远县| 鄂伦春自治旗| 修武县| 从化市| 锡林浩特市| 阳新县| 五河县| 栾城县| 湘西| 田林县| 多伦县| 铁力市| 都昌县| 六枝特区| 喀喇| 古浪县| 宁明县| 饶河县| 永和县| 扎赉特旗| 公主岭市| 苍梧县| 杭锦旗| 普陀区| 恩平市| 隆化县| 汉中市| 姚安县| 济源市| 贞丰县| 大化| 那曲县| 宁蒗| 潮安县|