zoukankan      html  css  js  c++  java
  • Hibernate错误:Unable to instantiate default tuplizer

    Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
        at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108)
        at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133)
        at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>

    出错原因:  role 类文件中 roleprivileges  写成  roleprivilege   ,与  hibernate xml配置文件不对应  ;造成 hibernate无法加载创建role

    public class role implements Serializable {
    private  String roleid;
    private String name;
    private String state;
    private Set<roleprivilege> roleprivileges;                     
    
    
    public static String ROLE_STATE_VALID="1";
    public static String ROLE_STATE_INVALID="0";
    
    
    public String getRoleid() {
        return roleid;
    }
    public void setRoleid(String roleid) {
        this.roleid = roleid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    
    
    public Set<roleprivilege> getRoleprivileges() {
        return roleprivileges;
    }
    public void setRoleprivileges(Set<roleprivilege> roleprivileges) {
        this.roleprivileges = roleprivileges;
    }
    public role() {
    
        // TODO Auto-generated constructor stub
    }
    public role(String roleid, String name, String state,
            Set<roleprivilege> roleprivileges) {
        super();
        this.roleid = roleid;
        this.name = name;
        this.state = state;
        this.roleprivileges = roleprivileges;
    }
    
    
    
    
    
    
    }
    <hibernate-mapping>
        <class name="cn.itcast.nsfw.role.entity.role" table="role">
            <id name="roleid" type="java.lang.String">
                <column name="role_id" length="32" />
                <generator class="uuid.hex" />
            </id>
            <property name="name" type="java.lang.String">
                <column name="name" length="20" not-null="true" />
            </property>
            
            <property name="state" type="java.lang.String">
                <column name="state" length="1"  />
                
            </property>    
            
            
            <set name="roleprivileges"      inverse="true" lazy="false" cascade="save-update,delete">
            <key>
            <column name="role"></column>
            </key>
            <one-to-many  class="cn.itcast.nsfw.role.entity.roleprivilege"/> 
            
            </set>
        
            
            
        </class>
    </hibernate-mapping>
  • 相关阅读:
    MongoCola Web化
    Qsys在系统集成中的应用
    js浏览器和浏览器插件检测的方法总结
    搭建一个简单的Struts2应用
    Moon.ORM最便捷轻盈的ORM
    如何从 Winform 移植到 Webform [自己搞定HTTP协议]
    细细品味Hadoop_Hadoop集群(目录)
    微软SQL Server 2012新特性Silverlight报表客户端 Power View
    json入门实例
    项目经理
  • 原文地址:https://www.cnblogs.com/yimian/p/8334597.html
Copyright © 2011-2022 走看看