VIRGIN FOREST OF JAVA
          不要埋頭苦干,要學(xué)習(xí),學(xué)習(xí),再學(xué)習(xí)。。。。。
          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) 評(píng)論(0)  編輯  收藏 所屬分類: HibernateJ2SE
          主站蜘蛛池模板: 保定市| 呼玛县| 金华市| 海原县| 上林县| 南和县| 沅陵县| 阿拉尔市| 东方市| 云林县| 阿城市| 高碑店市| 宁阳县| 临桂县| 福海县| 城步| 广汉市| 古蔺县| 泗洪县| 平陆县| 兰坪| 西华县| 高密市| 保德县| 拉孜县| 盐城市| 通道| 浦东新区| 习水县| 株洲县| 留坝县| 呼玛县| 三门峡市| 三原县| 策勒县| 商都县| 通榆县| 萝北县| 龙岩市| 六安市| 和林格尔县|