1 2 Previous Next 15 Replies Latest reply on Jul 23, 2002 8:38 PM by dsundstrom

    CMP 2.0 relationship problem.

    chris70

      Hi,

      I'm using JBoss3.0 with embedded Catalina 4.x with mySql.
      I have a entity bean named OrderBean with a orderType (int) attribute. This attribute can have values 1-4 and the relationship with one of MetalItemsBean, WoodItemsBean etc. depends on this value. This (lineItems like) beans have very different attributes and hence can't be combined into a single bean. Some of these beans even have (1-x) relationship with details beans.

      In a typical java model or JDO, its very easy to implement through polymorphism.

      But how do I design this in Entity Bean relationship??

      Thanks,
      Richard

        • 1. Re: CMP 2.0 relationship problem.
          dsundstrom

          I suggest you read this article on EJBs and inheritance:

          http://www.theserverside.com/resources/article.jsp?l=EJBInheritance

          • 2. Re: CMP 2.0 relationship problem.
            chris70

            Yeah, I read that when it was published but it doesn't actually excite me.
            I hope there's some solution based on dependent objects as its not so uncommon problem.
            To be more precise, in an older version of this product we had tables like
            order (with orderType)
            orderItemsMetal
            orderItemsWood
            orderItemsBoard

            and the stored procedure will populate the orderItemsXXX tables basedon orderType. How to do it in CMP2.0?

            Chris

            • 3. Re: CMP 2.0 relationship problem.
              chris70

              That article didn't really excite me.
              To be precise, in current version of this product, we have tables like
              order (id, type etc)
              orderItemsWood
              orderItemsBoard
              orderItemsMetal

              and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

              Chris

              • 4. Re: CMP 2.0 relationship problem.
                chris70

                That article didn't really excite me.
                To be precise, in current version of this product, we have tables like
                order (id, type etc)
                orderItemsWood
                orderItemsBoard
                orderItemsMetal

                and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                Chris

                • 5. Re: CMP 2.0 relationship problem.
                  chris70

                  That article didn't really excite me.
                  To be precise, in current version of this product, we have tables like
                  order (id, type etc)
                  orderItemsWood
                  orderItemsBoard
                  orderItemsMetal

                  and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                  Chris

                  • 6. Re: CMP 2.0 relationship problem.
                    chris70

                    That article didn't really excite me.
                    To be precise, in current version of this product, we have tables like
                    order (id, type etc)
                    orderItemsWood
                    orderItemsBoard
                    orderItemsMetal

                    and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                    Chris

                    • 7. Re: CMP 2.0 relationship problem.
                      chris70

                      That article didn't really excite me.
                      To be precise, in current version of this product, we have tables like
                      order (id, type etc)
                      orderItemsWood
                      orderItemsBoard
                      orderItemsMetal

                      and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                      Chris

                      • 8. Re: CMP 2.0 relationship problem.
                        chris70

                        That article didn't really excite me.
                        To be precise, in current version of this product, we have tables like
                        order (id, type etc)
                        orderItemsWood
                        orderItemsBoard
                        orderItemsMetal

                        and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                        Chris

                        • 9. Re: CMP 2.0 relationship problem.
                          chris70

                          That article didn't really excite me.
                          To be precise, in current version of this product, we have tables like
                          order (id, type etc)
                          orderItemsWood
                          orderItemsBoard
                          orderItemsMetal

                          and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                          Chris

                          • 10. Re: CMP 2.0 relationship problem.
                            chris70

                            That article didn't really excite me.
                            To be precise, in current version of this product, we have tables like
                            order (id, type etc)
                            orderItemsWood
                            orderItemsBoard
                            orderItemsMetal

                            and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                            Chris

                            • 11. Re: CMP 2.0 relationship problem.
                              chris70

                              That article didn't really excite me.
                              To be precise, in current version of this product, we have tables like
                              order (id, type etc)
                              orderItemsWood
                              orderItemsBoard
                              orderItemsMetal

                              and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                              Chris

                              • 12. Re: CMP 2.0 relationship problem.
                                chris70

                                That article didn't really excite me.
                                To be precise, in current version of this product, we have tables like
                                order (id, type etc)
                                orderItemsWood
                                orderItemsBoard
                                orderItemsMetal

                                and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                                Chris

                                • 13. Re: CMP 2.0 relationship problem.
                                  chris70

                                  That article didn't really excite me.
                                  To be precise, in current version of this product, we have tables like
                                  order (id, type etc)
                                  orderItemsWood
                                  orderItemsBoard
                                  orderItemsMetal

                                  and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                                  Chris

                                  • 14. Re: CMP 2.0 relationship problem.
                                    chris70

                                    That article didn't really excite me.
                                    To be precise, in current version of this product, we have tables like
                                    order (id, type etc)
                                    orderItemsWood
                                    orderItemsBoard
                                    orderItemsMetal

                                    and the stored procedure will populate the orderItemsXXX table based on the type. How do I do it in CMP 2.0 without messy code??

                                    Chris

                                    1 2 Previous Next