Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

OneToMany design issue in JPA

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to retrieve tweets by search keywords and save them in MySQL:

keyword table : id, keyword, tweet_id
tweet table: tweet_id,....

I only need bidirectional relation, in the class search Keyword I would like to retrieve all the corresponding tweets.

Should search Keyword entity have ManyToOne or OneToMany?

If ManyToOne on the search Keyword Entity, then how to retreiw the tweet resutls of a search Keyword? like this?





Thank you so much for your advices, I really want to understand these relationships. I'm completely confused and tired now.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

David Freed wrote:Thank you so much for your advices, I really want to understand these relationships. I'm completely confused and tired now.


When I'm in doubt, I always have a look at the Java Persistence Wikibook. It's really an excellent resource with tons of example mappings (both with annotation and xml).

Hope it helps!
Kind regards,
Roel
 
No, tomorrow we rule the world! With this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic