1 Reply Latest reply on Aug 13, 2005 1:10 AM by evan3107

    Self OneToMany relation

    murtuza52

      Hello,

      I am using MyEclipse with JBoss 4.0.2 with EJB 5 Preview. The database is MySQL 4.1.10 and OS is Windows XP Professional. I have a table Category with following fields

      catid (int)
      name (string)
      parent (int) (referenceing catid as its parent)
      descriptio (string)

      I want to create the OneToMany relation in this table to form the heirarchical structure of category having sub-categories and more sub-categories upto probabely 3 level.

      Can anyone help me on how to write the OneToMany relation here in the Entity Bean. I suppose once the relation is written it can be used in Session bean in similar way to as any othe OneToMany relation like retrieving, adding and deleting categories.

      I'll appreciate if anyone canshow the resource to explain this or sample code.

      Thanks in advance.

      Murtuza

        • 1. Re: Self OneToMany relation
          evan3107

          Does anyone have a simple example of how to do this? A onetomany relationship in the same table. A very typical scenario for display categories or any type of tree view structure. There must be a way to do this.

          Thanks,
          Evan