Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Object Relational Mapping
Error book Hibernate Recipes a problemsolution approach(@OneToMany bidirectional Using a Join Table)
Ricardo Llontop
Greenhorn
Posts: 11
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The book say:
@Entity (name="bkch73") @Table (name="BOOK7_3", schema="BOOKSHOP7") public class Book7_3 { . @OneToMany(targetEntity=Chapter7_3.class,mappedBy="book") @JoinTable(name = "Book_Chapter",schema="BOOKSHOP7", joinColumns = { @JoinColumn(name="book_id") } ) @Cascade (value={CascadeType.SAVE_UPDATE,CascadeType.DELETE_ORPHAN}) private Set chapters;
and in the other relation put:
@Entity (name="chapter73") @Table (name="Chapter7_3", schema="BOOKSHOP7") public class Chapter7_3 { @Id @GeneratedValue (strategy=GenerationType.TABLE) @Column (name="id") private long id; @ManyToOne @JoinTable( name="Book_Chapter", schema="BOOKSHOP7", joinColumns=@JoinColumn(name="id") ) @JoinColumn (name="book_id") private Book7_3 book; @Column (name="title") private String title; @Column (name="NUM_OF_PAGES") private int numOfPages; // getters and setters }
When I run this thw
Junit
lunch a error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [META-INF/spring/spring-master.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [META-INF/spring/spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn:
How avoid this issued or this the book wrong??
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Mysql auto generated PK used for another table and JPA
How do I get a UserDetails object from a Principal object?
JPA - need help with query
Confused with many to many,
Problems in JPA with a Collection of Dates
More...