Hibernate version:
3.1rc2
3.1beta6 annotations
Name and version of the database you are using:
MySql 4
I have the following relationship
Code:
GenericProfile (embedebble superclass)
-----------
profile_id
image (no image_id foreign key in this table)
...
..
that has a one-to-one unidirectional relationship to an image
Code:
Image
-----------
image_id
imageData
(profile_id) -- only in the database table not on the class
...
..
I have other sub classes of the GenericProfile that need to inherit the relationship. I can't make the relationship bi directional because GenericProfile is not an entity. I've tried many variations of the OneToOne annotation on the GenericProfile with no luck. E.g.
Code:
@OneToOne()
@JoinColumn(name = "profile_id", referencedColumnName = "profile_id", nullable = false)
I've also searched the forum and saw that it might be possible with a ManyToOne or ManyToMany with the unique attribute set. E.g.
Code:
@ManyToMany()
@JoinColumn(name = "profile_id", referencedColumnName = "profile_id", nullable = false, unique = true, insertable = false, updatable = false)
I've seen some posts that seem to indicate that it's impossible and others that say it is possible. Could anyone let me know if this is possible or not and possibly provide some advice on how I might be able to get around it if it is possible?
Thanks