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

时间:2022-10-03 15:53:59

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. Tables:

如果你对标题感到困惑,我会尝试解释我的想法。事实上它很简单。我有3个表(还有更多,但现在不重要),我尝试映射,但它不起作用。表:

1) Poseta

datumPosete, idKlijenta, UkupnaCena, idMehanicara

datumPosete,idKlijenta,UkupnaCena,idMehanicara

2) Usluga

idUsluga, NazivUsluge

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. I apologise on my English, if I made some mistakes. Also I am very grateful everybody who answer.

我粗体主键。正如您所看到的,StavkaPosete表的主键由主键Usluga表和主键Poseta表组成。如果我犯了一些错误,我会对我的英语道歉。我也非常感谢所有回答的人。

1 个解决方案

#1


0  

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

那么它的CompoundIdentity然后一个类的身份包括另一个持久对象http://www.datanucleus.org/products/accessplatform_3_0/jpa/orm/compound_identity.html

#1


0  

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

那么它的CompoundIdentity然后一个类的身份包括另一个持久对象http://www.datanucleus.org/products/accessplatform_3_0/jpa/orm/compound_identity.html