日期:2014-05-17  浏览次数:20698 次

hibernate 的dynamicUpdate = true 为什么不起作用?
用的是spring的extends HibernateDaoSupport操作数据库。
类似代码:getHibernateTemplate().saveOrUpdate(xxx);
实体类代码如下:
Java code
package com.map.model;    
   
import javax.persistence.Entity;    
import javax.persistence.GeneratedValue;    
import javax.persistence.GenerationType;    
import javax.persistence.Id;    
import javax.persistence.Table;    
   
@Entity   
@org.hibernate.annotations.Entity(dynamicUpdate = true)    
@Table(name = "test")    
   
public class Test{    
   
   
    // Fields    
   
    private long id;    
    private String name;    
    private String descn;//描述    
    // Property accessors    
   
    @Id   
    @GeneratedValue(strategy = GenerationType.AUTO)    
    public long getId() {    
        return this.id;    
    }    
   
    public String getDescn() {    
        return descn;    
    }    
        
   
   
   
    public String getName() {    
        return name;    
    }    
   
    public void setName(String name) {    
        this.name = name;    
    }    
   
   
   
    public void setId(long id) {    
        this.id = id;    
    }    
   
    public void setDescn(String descn) {    
        this.descn = descn;    
    }    
   
   
}    


log 出来还是Hibernate: update test set descn=?, name=? where id=?  

我希望是 Hibernate: update test set descn=? where id=? 


------解决方案--------------------
转别人的帖:http://qbar.qq.com/u2011541/19.htm