Hi Greg,
Do you see problems using @ManyToMany? Don't forget to pick the owning side.
thanks,
-marina
Greg Ederer wrote:
> Hi,
>
> I have a Category class. According to my model, a Category can have many
> parent Categorys and many child Categorys. I'm having trouble getting
> the JPA annotations right for this relationship. I'm sure that this must
> be trivially easy.
>
> The source might something look like:
>
> @Entity
> public class Category
> {
> @Id
> private Long id;
>
> protected String name;
>
> @???
> protected List<Category> parentCategories = new ArrayList<Category>();
>
> @???
> protected List<Category> childCategories = new ArrayList<Category>();
>
> ...
> }
>
> What is the correct way to do this?
>
> Thanks!
>
> Greg
>