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>