reading the docs (pasted below) it says that the pk needs to be the same on both objects, i have a situation where I need to have just one object returned
but they wont both have the same pk.
i want to have a user.getGallery() but the Gallery object has a different pk that the User object does so I cant use this one-to-one and it looks like I need to use a one-to-many holding just one object , is there anyway around this?
i need the tables look like this:
User table has columns, id, name, galleryId
Gallery table has columns id, name
i basically need a Gallery (which contains a set of galleryImages) that I can attached to anything like say an article or user or event
I need a user.getGallery but dont need a gallery.getUser etc
hope you guys can understand my question, its late :)
4.1.11. one-to-one
A one-to-one association to another persistent class is declared using a one-to-one element.
One-to-one associations don't need an extra table column; if two rows are related by a one-to-one association then the two table rows share the same primary key value. So if you want two objects to be related by a one-to-one association, you must make sure that they are assigned the same identifier value!
|