TVillageBasic.hbm.xml如下:
<class name="com.cdx.pj.model.TVillageBasic" table="T_VILLAGE_BASIC" schema="PJ">
        <id name="code" type="string">
            <column name="CODE" length="10" />
            <generator class="assigned" />
        </id>
        <property name="rq" type="timestamp">
            <column name="RQ" length="7" not-null="true" />
        </property>
        ............
</class>TVillageBasic instance = (TVillageBasic) getSession().get(
"com.cdx.pj.model.TVillageBasic", strCode);
         System.out.print(instance.getName());
         instance.setCode("20033322");
         instance.setName(instance.getName() + "1");
         instance.setBz2(tmp);
         instance.setRq(new Date());
         Transaction t = getSession().beginTransaction();   
         try {
             //这里不管是执行save/update/delete/saveOrUpdate什么方法都操作无效,数据库没变化。但就是不报错!?
             //getSession().delete(instance);
             getSession().update(instance);
             getSession().save(instance);   
             t.commit();   
         } catch (HibernateException e) {   
            e.printStackTrace();   
            t.rollback();   
         } finally {   
          getSession().close();   
         }

解决方案 »

  1.   

    你在你的or配置中加上这句吧:catalog="数据库名称"<class name="com.cdx.pj.model.TVillageBasic" table="T_VILLAGE_BASIC" catalog="数据库名称"> 这样应该就可以啦
      

  2.   

    设置show_sql看看执行的sql语句
      

  3.   

    Hibernate: select tvillageba0_.CODE as CODE94_0_, tvillageba0_.RQ as RQ94_0_, tvillageba0_.AREA as AREA94_0_, tvillageba0_.PEOPLE as PEOPLE94_0_, tvillageba0_.HS as HS94_0_, tvillageba0_.KJFW as KJFW94_0_, tvillageba0_.ZHFW as ZHFW94_0_, tvillageba0_.TMFW as TMFW94_0_, tvillageba0_.DZST as DZST94_0_, tvillageba0_.SZST as SZST94_0_, tvillageba0_.HD as HD94_0_, tvillageba0_.YT as YT94_0_, tvillageba0_.LD as LD94_0_, tvillageba0_.YD as YD94_0_, tvillageba0_.BHJL as BHJL94_0_, tvillageba0_.BHMC as BHMC94_0_, tvillageba0_.BZ1 as BZ17_94_0_, tvillageba0_.BZ2 as BZ18_94_0_, tvillageba0_.NAME as NAME94_0_ from T_VILLAGE_BASIC tvillageba0_ where tvillageba0_.CODE=?Hibernate 输出这么一条。1.加上catalog="数据库名称",报错;
    2.schema去掉也不行;多谢
      

  4.   

    现在执行到了,但是出错:数据大小超出此类型的最大值这个表有一个Blob字段,我设置的类型是byte[],映射如下:
    <property name="bz2" column="BZ2" type="binary">  我这样设置是否正确?
      

  5.   

    oracle通常是
    byte[]对应type="org.springframework.orm.hibernate3.support.BlobByteArrayType"