Sorry, I have mistakenly copied and pasted the wrong annotations for the
collection of VoParagraphData. Here is the correct annotation for it:
@ElementCollection
@CollectionTable(name="TPARA",
joinColumns={
@JoinColumn(name="PARA_ID", referencedColumnName="DTG_OBJ_ID"),
@JoinColumn(name="PARA_VNBR", referencedColumnName="DTG_OBJ_VNBR")
}
)
protected Collection<VoParagraphData> paraObjects;
----- Original Message ----
From: Fay Wang <[email protected]>
To: [email protected]
Sent: Mon, July 12, 2010 4:09:31 PM
Subject: Re: JPA genereates non-exist id column in the select statement
Since the underlying table does not have primary key, you might want to make
VoParagraphData an embeddable:
@Embeddable
public class VoParagraphData implements Serializable {
In the VoDocumentTemplateGroupObjectData, you can make the collection of
VoParagraphData an ElementCollection:
@ElementJoinColumn(name="PARA_VNBR",referencedColumnName="DTG_OBJ_VNBR")})
@ElementCollection
@CollectionTable(name="TPARA",
joinColumns={
@JoinColumn(name="PARA_ID", referencedColumnName="DTG_OBJ_ID"),
@JoinColumn(name="PARA_VNBR", referencedColumnName="DTG_OBJ_VNBR")
}
)
protected Collection<VoParagraphData> paraObjects;
----- Original Message ----
From: llchen <[email protected]>
To: [email protected]
Sent: Mon, July 12, 2010 3:51:45 PM
Subject: RE: JPA genereates non-exist id column in the select statement
Thanks for promptly replying. But how do I handle the entity without a
primary key as the underline table does not have one? Set up a fake primary
key in the entity or what?
Lule
_____
From: Rick Curtis [via OpenJPA]
[mailto:[email protected]]
Sent: Monday, July 12, 2010 10:53 AM
To: llchen
Subject: Re: JPA genereates non-exist id column in the select statement
Section 2.4 of the 2.0 spec states "Every entity must have a primary key."
I seem to remember that OpenJPA will do some magic when we enhance your
Entities if we don't find an @Id column... I don't have time to try this am,
but I'd be willing to bet that is what's going on.
tht,
Rick
_____
View message @
http://openjpa.208410.n2.nabble.com/JPA-genereates-non-exist-id-column-in-th
e-select-statement-tp5282960p5283244.html
To unsubscribe from JPA genereates non-exist id column in the select
statement, click
< (link removed)
aGVuQHN5bXBhdGljby5jYXw1MjgyOTYwfDIzMDMwNjc3MQ==> here.
--
View this message in context:
http://openjpa.208410.n2.nabble.com/JPA-genereates-non-exist-id-column-in-the-select-statement-tp5282960p5285218.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.