I am having a problem where instead of just saving a reference to a
class, HIbernate is creating a two database entries with the same
information. Here is a quick outline of the problem:
I have a contact class & image class
The contact class hold the following image info:
public var defaultImage : ImageVO;
[ArrayElementType("com.onefoot.dbocl.vo.misc.ImageVO")]
public var images : ArrayCollection = new ArrayCollection();
Thus one can store an unlimited amount of images for each contact.
And assign one of those images as the default image.
I have dataservices set up to automatically manage my contacts
collection through Hibernate... thus when I add
contactVO.defaultImage = someImageVO;
the image gets added to the images table in mysql.
an entry gets added to the contacts_images table.
what you would expect...
However if I do the following:
contactVO.defaultImage = someImageVO;
contactVO.images.addItem(contactVO.defaultImage);
Then two entries get added to the images table. basically the image
gets duplicated in the table instead of just adding the default image
id to the contacts table...
Any thoughts on how I should be approaching this differently to get
this to work. I realize all to well that these set ups are hard to
describe so if you need more information please ask.
Thanks for your help.
- Kevin