Java Persistence API - annotations - III

26 July 2008

Continued from the lasr 2 posts.

If each entity instance is related to a single instance of another entity, then one-to-one relation exists and

@OneToOne(javax.persistence.OneToOne) is used.
If an entity instance can be related to multiple instances of other entities, then one-to-many relation exists and

@OneToMany(javax.persistence.OneToMany) is used.
If multiple instances of an entity can be related to a single instance of the other entity,then many-to-one relation exist and

@ManyToOne(javax.persistence.ManyToOne) is used.

If entity instances can be related to multiple instances of each other, then we say that many-to-many relation exist and @ManyToMany (javax.persistence.ManyToMany) is used.

del.icio.us:Java Persistence API - annotations - III  digg:Java Persistence API - annotations - III  spurl:Java Persistence API - annotations - III  wists:Java Persistence API - annotations - III  simpy:Java Persistence API - annotations - III  newsvine:Java Persistence API - annotations - III  blinklist:Java Persistence API - annotations - III  furl:Java Persistence API - annotations - III  reddit:Java Persistence API - annotations - III  fark:Java Persistence API - annotations - III  blogmarks:Java Persistence API - annotations - III  Y!:Java Persistence API - annotations - III  smarking:Java Persistence API - annotations - III  magnolia:Java Persistence API - annotations - III  segnalo:Java Persistence API - annotations - III  gifttagging:Java Persistence API - annotations - III

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Java Persistence API - annotations - III

Leave a Reply