Joined: Thu Jun 24, 2010 1:29 pm Posts: 2
|
I am green in hibernate. While trying to execute HQL statemant "from User" I am getting this error: org.hibernate.MappingException: An association from the table GRANTED_FUNCT_PERMISSION refers to an unmapped class: F.FunctPermission at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1252) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:324) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859) My setup is this: I have these 3 tables in sqlserver DB: USER pk: id name pass
FUNCT_PERMISSION PK: id name
GRANTED_FUNCT_PERMISSION FK:userID FK: permissionID
i have this hibernate.cfg.xml configuration file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;databaseName=PRS_KE</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password">******</property> <property name="hibernate.current_session_context_class">thread</property> <mapping resource="F/FunctPermission.hbm.xml"/> <mapping resource="F/User.hbm.xml"/> </session-factory> </hibernate-configuration> I have these mapping files: User.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-24 20.21.48 by Hibernate Tools 3.2.1.GA --> <hibernate-mapping> <class name="F.User" table="USER" schema="dbo" catalog="PRS_KE"> <id name="id" type="int"> <column name="ID" /> <generator class="assigned" /> </id> <property name="name" type="string"> <column name="NAME" length="15" not-null="true" /> </property> <property name="pass" type="binary"> <column name="PASS" not-null="true" /> </property> <set name="functPermissions" inverse="false" table="GRANTED_FUNCT_PERMISSION"> <key> <column name="USER_ID" not-null="true" /> </key> <many-to-many entity-name="F.FunctPermission"> <column name="PERMISSION_ID" not-null="true" /> </many-to-many> </set> </class> </hibernate-mapping>
FunctPermission.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-24 20.21.48 by Hibernate Tools 3.2.1.GA --> <hibernate-mapping> <class name="F.FunctPermission" table="FUNCT_PERMISSION" schema="dbo" catalog="PRS_KE"> <id name="id" type="int"> <column name="ID" /> <generator class="assigned" /> </id> <property name="name" type="string"> <column name="NAME" length="15" not-null="true" unique="true" /> </property> <property name="comment" type="string"> <column name="COMMENT" /> </property> <set name="users" inverse="false" table="GRANTED_FUNCT_PERMISSION"> <key> <column name="PERMISSION_ID" not-null="true" /> </key> <many-to-many entity-name="F.User"> <column name="USER_ID" not-null="true" /> </many-to-many> </set> </class> </hibernate-mapping> I have these generated classes User.java FunctPermission.java
All hibernate configuration mapping and classes are generated by Netbeans 6.9 IDE I have read some posts where class was not mapped or smth, but here i think i have it mapped i dont understand it says its not mapped thanks for help in advance
|
|