Today the project encountered this problem, engaged in the majority of days, I am depressed ...
Hibernate Federated Primary Key configuration (multiple fields together as primary key)
<class name= "COM.CSKJ.HIBERNATE.MAP.BBWJJC" table= "BB_WJJC" schema= "dbo" catalog= "WJGL" >
<composite-id name= "id" class= "com.cskj.hibernate.map.BbWjjcId" >
<key-property name= "Wjtmid" type= "Java.lang.Long" >
<column name= "Wjtmid"/>
</key-property>
<key-property name= "Wjxxid" type= "Java.lang.Long" >
<column name= "Wjxxid"/>
</key-property>
<key-property name= "Wjzxxid" type= "Java.lang.Long" >
<column name= "Wjzxxid"/>
</key-property>
<key-property name= "Wjztmid" type= "Java.lang.Long" >
<column name= "Wjztmid"/>
</key-property>
<key-property name= "Wjid" type= "Java.lang.Long" >
<column name= "Wjid"/>
</key-property>
</composite-id>
Generate files for primary keys
public class Bbwjjcid implements Java.io.Serializable {
Private Long Wjtmid;
Private Long Wjxxid;
Private Long Wjzxxid;
Private Long Wjztmid;
Private Long Wjid;
。。。
Use the HQL statement when querying a single primary key
From BBWJJC bw where bw. Bbwjjcid.wjid=?
Result Error:
Could not resolve Property:bbwjjcid OF:COM.CSKJ.HIBERNATE.MAP.BBWJJC [from COM.CSKJ.HIBERNATE.MAP.BBWJJC bw where bw. Bbwjjcid.wjid= ' 5 ']
On the internet to check a bit, said is the problem of HQL statement.
Test the most of the day results debugging is normal, the original is BW. bbwjjcid.wjid=. Bbwjjcid to write the name of the mapping XML (that is: ID), the PK class name cannot be written.
Right Hql:from BBWJJC bw where bw.id.wjid=? Tough fix!!!
Hibernate Federated Primary Key Composite-id mapping, querying for single primary key issues (RPM)