[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Wrong One-To-Many Mapping


The Javadoc for OneToMany might help you:
http://java.sun.com/javaee/5/docs/api/javax/persistence/OneToMany.html

You probably want to specify @JoinColumn(name="BOOK_ID") 

Gili


PLC_David wrote:
> 
> Hi, 
> 
> I tested the jpa with the eclipseLink provider.
> But I have many problems with the annotations.
> 
> My DTOs:
> 
> @Entity
> @Table(name=PLC.BOOKS)
> public BookDTO {
> 
> int id;
> ...
> @OneToMany
> List<ChapterDTO> chapterList;
> }
> 
> @Entity
> @Table(name=PLC.CHAPTERS)
> ChapterDTO {
> int id;
> @Embedded
> AutorDTO autor;
> ...
> }
> 
> @Embeddable
> AutorDTO {
> 
> String ...
> ...
> }
> 
> 
> I have a one-to-many relationship. There is a column BOOK_ID in the table
> CHAPTERS which realize this relationship. 
> 
> But JPA generates the wrong select. It takes a column which not exists.
> select ..... from ... where t0.id = .. and t1.id = t0.chapterList_ID
> 
> Can anybody tell me what I need at this relationship?
> 

-- 
View this message in context: http://www.nabble.com/Wrong-One-To-Many-Mapping-tp19527921p19533966.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.