• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Directionality in JPA  RSS feed

 
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,
I am a bit confused regarding the concept of Directionality in JPA.
Why is it important to consider the directionality?
I understand that an entity having a reference to other entity accounts for a direction, but is it all to it?
Do my mapping annotations have any thing to do with directionality, or they simply indicate the cardinality?

Help me get the basics straight.

Thanks in advance.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sudhanshu Mishra,

Let me add some words that may help you,

Why is it important to consider the directionality?



The main point of a ORM is to reflect the database model. Sometimes, changing the directionality of an entity relationship requires a different database model. Besides that, it's important to know how annotations may be used together, for example, an unidirectional property annotated with @OneToMany may define the @JoinTable annotation to override the defaults.

I understand that an entity having a reference to other entity accounts for a direction, but is it all to it?



Pretty much. But make sure you can spot the directionality for a given model, e.g.



Although it seems to be a bidirectional relationship, it's not.

Do my mapping annotations have any thing to do with directionality, or they simply indicate the cardinality?



Your mappings indicate both implicitly or explicitly, but there's nothing special about those concepts. While directionality it's about how entities reach each other, cardinality defines if an entity has one or more instances of a referenced entity.

Cheers!
 
please buy this thing and then I get a fat cut of the action:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!