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

    Self OneToMany relation

    Murtuza Vohra Newbie


      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.