[Hibernate] self-referential table

2003-09-09 Thread sw-list
Alright, so I've searched all over the web (this list doesn't appear to be archived either), so here I am ;-). I am finally getting into using Hibernate on a few projects and have run across something that I'm sure how it would be handled. I have one table that uses itself as a collection. Bas

Re: [Hibernate] self-referential table

2003-09-09 Thread Gavin King
Theres nothing particularly special about this. Just map it as you would any other association. The only problem is your -1, which breaks referential integrity of the whole table! just switch to using an SQL null. [EMAIL PROTECTED] wrote: Alright, so I've searched all over the web (this list d

Re: [Hibernate] self-referential table

2003-09-10 Thread sw-list
On Tuesday, September 9, 2003, at 07:07 PM, Gavin King wrote: Theres nothing particularly special about this. Just map it as you would any other association. The only problem is your -1, which breaks referential integrity of the whole table! just switch to using an SQL null. Ok, I guess this is

Re: [Hibernate] self-referential table

2003-09-10 Thread Warner Onstine
Got this working! Now I have another question with regards to collections in general. I tried to do this: Set subCategories; public void setSubCategories() public Set getSubCategories() public void addSubCategory() public void removeSubCategory() in add and remove I refer to the collection subCat

Re: [Hibernate] self-referential table

2003-09-10 Thread Gavin King
Nope, the set/get are required. Warner Onstine wrote: Got this working! Now I have another question with regards to collections in general. I tried to do this: Set subCategories; public void setSubCategories() public Set getSubCategories() public void addSubCategory() public void removeSubCateg

Re: [Hibernate] self-referential table

2003-09-10 Thread jiesheng zhang
It definitely works. I have many such methods like what you mentioned. Post your method implementation and exception here. Let me have a look. jason --- Warner Onstine <[EMAIL PROTECTED]> wrote: > Got this working! > > Now I have another question with regards to > collections in general. > >

Re: [Hibernate] self-referential table cont'd

2003-09-12 Thread Warner Onstine
Ok, For some reason my Unit tests were passing when I wasn't using hibernate to persist (even though they shouldn't have), I found my problem (I wasn't initializing the internal Set before trying to use it - doh!). So, this is now working, but I am experiencing another problem. Here's my layout