简体   繁体   English

JPA映射:关联哪个主键是一个实体的复合主键和另一个实体的一个属性的复合

[英]JPA mapping: Assositation which primary key is compound of composite primary key of one entity and one atribute of other entity

If you are confused with title, i will try to explain what i was thinking.In matter a fact it's pretty simple.如果您对标题感到困惑,我将尝试解释我的想法。事实上,这很简单。 I have 3 tables (there is more, but it's not important now), which i try to map, but it don't work.我有 3 张桌子(还有更多,但现在不重要),我尝试使用 map,但它不起作用。 Tables:表:

1) Poseta 1) 波塞塔

datumPosete , idKlijenta , UkupnaCena, idMehanicara datumPosete , idKlijenta , UkupnaCena, idMehanicara

2) Usluga 2) 乌斯鲁加

idUsluga , NazivUsluge idUsluga

3) StavkaPosete 3)StavkaPosete

datumPosete , idKlijenta , idUsluge , Kolicina datumPosete , idKlijenta , idUsluge , Kolicina

I bold primary keys.我加粗主键。 As you can see primary key of StavkaPosete table is composed of primary key Usluga table and primary key Poseta table.如您所见,StavkaPosete 表的主键由主键 Usluga 表和主键 Poseta 表组成。 I apologise on my English, if I made some mistakes.如果我犯了一些错误,我就我的英语道歉。 Also I am very grateful everybody who answer.我也非常感谢所有回答的人。

So its CompoundIdentity then where the identity of one class includes another persistent object http://www.datanucleus.org/products/accessplatform_3_0/jpa/orm/compound_identity.html So its CompoundIdentity then where the identity of one class includes another persistent object http://www.datanucleus.org/products/accessplatform_3_0/jpa/orm/compound_identity.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM