Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating or updating information in EJB(ref PetStore)

 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question on the update/creation strategy used by the Petstore architecture.
If you look at the CustomerEJBAction, first the customer is created.
Since it is a composite entity all the Do's get created as well.
Now after the DO's are created calls to getAccountLocal contactInfolocal,creditcard etc are made in the ShoppingclientFacade and updates done to those values by sets. Why cant the values have been set at the time of creation like when a customer is created using the home.create(userId);.In a similar way the account values etc can be created isntead of calling sets which seems more like an udpate to me.
Is this the only way ?

Thanks
Dhiren
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhiren,

If you look at the petstore Data Model (or ERD) you will find that some of these tables cross-reference each other. For example: Customer table has AccountID and Account table has reverseCustomerID.

To support this kind of reverse relationship, they might be doing create followed by updates on few entity beans.

regards,
Deepak
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic