• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use EJB-Relationships??

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am developing EJB's for my Web Application. I am using PostgreSQL 8.0 as Database. In My database there is already reletionship defined between table. My question is that still there is necesity of define relationship between EJB's? as realtionship is already defined in database between tables.
I have successfully defined relationships between EJB's in my Beans Code.
If answer of my above question is "yes" then how to utilize the relationship? & also please tell me what is use of EJB relationship if there is already relationship defined between tables in my database.

Thanx in Advance.

Prash.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The relationship you defined in DB is for database objects and is used for data consistency and is purely relational model. However you still need to define the relationship in EJB (ORM). By defining relationship in EJB you ensure all the related data is loaded/inserted/updated when an object with dependency is loaded/updated/inserted.

Say for example you have two tables
Employee and Department
when you read the details of Employee you can also read the details of the department associated with the employee. For more information you can look into Mastering EJB by Ed Roman or any other EJB book.
 
reply
    Bookmark Topic Watch Topic
  • New Topic