org.hibernate.exception.GenericJDBCException:无法加载实体:[com.cartif.database.Role #Project]

时间:2011-06-21 09:45:35

标签: hibernate java-ee

我正在使用Hibernate进行开发。所以,当我想加载一个eentity时,我得到一个错误,如:

org.hibernate.exception.GenericJDBCException: could not load an entity: [com.cartif.database.Role#Project]

我的hibernate映射文件是:

<hibernate-mapping> 
<class name="com.cartif.database.Role" table="Role">
    <id column="name" name="name" type="java.lang.String"/>
    <property column="permission" generated="never" lazy="false" name="permission" type="java.lang.Integer"/>
</class>
</hibernate-mapping>

会话的呼叫是:

(Role)DatabaseManager.loadObject(Role.class, loadUser(login).getRole())

public static Object loadObject(Class o, String id){
    if(session == null) createSession();
    return session.get(o, id);
}

我已经检查了包和表的名称,但它们没问题!问题是什么?

谢谢!

问候!

1 个答案:

答案 0 :(得分:0)

抱歉,我连接的用户没有权限。我在数据库中向用户添加授权,然后运行!