openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruslan <>
Subject Re: AW: How to make compound id via @EmbeddedId
Date Fri, 21 Nov 2008 19:59:35 GMT

That is surprise to me. Thanks a lot for pointing out. I didn't know that
@Embeddable classes have to be registered in persistence.xml because I
thought it's necessary only for entity classes. Perhaps it would be great to
mention it in section "1.4. Embeddable" of the documentation.

Another interesting thing is that I can't register inner class in
persistence.xml like


Here is example of the class:

Is it by design or a bug ?

OpenJPA doesn't enhance it. So I had to make PrimaryKey public and move to
upper level. Now it works but only if I use primitives in PrimaryKey. Here
are my classes:


Could you please tell me what I need to modify in PrimaryKey in order to
make an object of ElectronicBooksEntity rather than
numerical int ?

Here is what I tried:

I also tried to define @OneToMany relation in ElectronicBooksEntity (even
though I want to have unidirectional relation) as:

    @OneToMany(mappedBy="", cascade = CascadeType.ALL, fetch
= FetchType.EAGER)
    private List<ElectronicBooksDataEntity2> datas;

but it didn't help either.

PS. There was another person who asked exactly the same question: 
but looks like he wasn't able to crack it down either.

Mark Struberg wrote:
> All other classes have been enhanced?
> Let's start with the most obvious: is the <class> PrimaryKey registered in
> your persistence.xml? @Embeddable also have to be registered there.
> LieGrue,
> strub

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message