• 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

CMR gone in EJB 3.0

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just read something on Sun's website that mentioned that the EJB 3.0 spec dropped support for CMR.

I'm looking into using EJB, but I want to know for sure what this statement means.

If I have two entity beans, Order and LineItem and my Order object has a List of LineItem objects, how will the elimination of CMR affect this relationship?

Thanks!

Paul
 
author
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul-
What this means is EJB 3 no longer maintains the relationship field at the other end of the relationship when one end is updated. For instance, in a 1:* relationship, if you insert into the collection end, the single-value end doesn't get updated automatically on the entity, and vice-versa. In EJB 2.x, the relationship field on the other end would automatically get wired up for you, which was convenient but incurred a huge overhead for the persistence manager. You can emulate the EJB 2.x behavior by modifying your entity code (or using a code generator to build your entities).

A common pattern is to define add/remove methods to accompany the Collection field, and modify the set method on the single-value end. In both cases, the idea is to update the field at the other end of the relationship.

The bottom line is relationships between JPA entities (successors to entity beans) are still supported, but the automatic wiring feature in EJB 2.x CMR fields is no longer there.

Regards,
Jon

Beginning EJB 3 Application Development: From Novice to Professional
 
Paul Eggerling-Boeck
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jon. That sounds pretty much like what I'm used to doing in a Hibernate environment.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Eggerling-Boeck:
Thanks Jon. That sounds pretty much like what I'm used to doing in a Hibernate environment.




"pretty much"? actually more "exactly" like.

Mark
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic