• 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

Why we cannot assign the persistent relationship field in ejbCreate() ?

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

I have a problem when I am reading the HFEJB Page 396.

It is said that we must NOT try to reference our own persistent
RELATIONSHIPS in ejbCreate(). But,it is safe to assign the persistent relationship field in ejbPostCreate().

I cannot understand that.

In ejbCreate() method, the container will use the persistent fields to make
the new row in the database. For the CMR field, there should be a
corresponding foreign key field in the row. Why, the foreign key field cannot be inserted into the row, together with the other persistent fields?


Thanks a lot!
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steven,

the row will be inserted in the database after ejbCreate() finishes. So while you are in ejbCreate(), you still dont have data that you are trying to refer. but that row/data will be available in ejbPostCreate() method.

Thanks,
Ugender
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic