I am using Hibernate 3.2.5 for my application.
I have a department table and a
employee table
Dept.java
Private Ent DPID; Private string deptName; Private map empMap = new hashmap (); // Gates and Setters
Employee. Java
Private Imp. IPID; Private string empName; Private Ent DPID; Personal gaps ages; Private string sex; Department of Private Department; // Gates and Setters Association between the two:
& lt; Map name = "empMap" inverse = "false" cascade = "all" & gt; & Lt; Major column = "DEPT_ID" & gt; & Lt; / Key & gt; & Lt; Map-key formula = "EMP_ID" type = "integer" & gt; & Lt; / Map-key & gt; & Lt; One-to-many classes = "com.jdbc.Employees" /> & Lt; / Map & gt; When I try the following statement:
query hqlQuery = session.createQuery ("From the Department Department where dept.empMap.empName = 'XYZ ''); I get the following exception:
org.hibernate.QueryException: dereference collection with reference to element [dept0_.DEPT_ID.empMap] is invalid Effernames [EmpName] [com.jdbc.Dept dept from where dept.empMap.empName = 'XYZ']
Please know how to use the inherent login here Reading the doctor, I can not understand what I am missing.
You're trying to use a collection like a property you can do instead Are: Dept dept internal join dept.empMap emp from
where emp.empName = 'XYZ'
No comments:
Post a Comment