Discussions

EJB programming & troubleshooting: design multiple tables with BMP Entity Bean without mapping tool

  1. I have a question is bothering me ...

    We are converting our present web-application from
    jsp/servlet to jsp/servlet/ejb.
    We have a question that, Does J2EE-EJB support to code
    entitnybeans with multiple tables(parent/child/childs)?


    child table should be maintained seperately and also with it's parent and same for the remaining all the relations..

    We are not using any mapping tools,we would like to
    use BMP Entity Beans to do this if it supports,but not seen any good example how to do handle this situation...


    I have seen lot of
    discussions,every one has question,some comments,but
    not clear answer,please direct me to good reference/article on this topic or give me clue to proceed to handle this situation,if possible.

    Please reply at your earliest.

    thanks,
  2. Ravi,
    With BMP you code your own persistence logic (via JDBC), so you can definitely support Parent/Child relationships. Even though you can do it many ways (since you have full control over your database access logic), I will suggest looking at the dependent value objects pattern. There is an excellent article and Example Code :) on this site. Check http://www2.theserverside.com/patterns/depbmp.jsp
    -Anil
  3. I have seen the article you have adviced,it is good one.But it has some conditions like..
    'Since our addresses and job entries are dependent value objects, they do not have their own identity outside of their parent Resume entity bean, and thus they do not have their own primary key, instead they are identified by a resumeID column in the addresses and job entries table.....', Which will not be true in realtime always,most of the time these child tables should be able to be maintained seperately and also with parent.Another thing is these tables could be interacted directly thru web-tier,then how we can notify the changes in the child tables to it's parents,If you look at in depth with broad scope,there are many problems that we should handle and did not find the best way,
    Would anyone please advice or continue the discussion..

    Thanks
  4. I have been waiting for answers and to continue the discussion, but not seen anyone attempting to answer the question.