]
Emmanuel Bernard resolved ANN-680.
----------------------------------
Resolution: Rejected
the reference column has to be unique to uniquely identify a given row/entity in your
source table.
If you are designing a new model, I would recommend to rethink your db schema, something
is wrong (and masochist, naming a non unique column as *_ID is all about pain ;) ). If
you're stuck with a legacy model, I imagine that APPLE_ID somehow is unique and the pk
of an implicit third entity/table. I would recommend to make it explicit (maybe using a
view)
Please use the user forum
oneToMany relationship, in which the source table column does NOT
contain a unique constraint
---------------------------------------------------------------------------------------------
Key: ANN-680
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-680
Project: Hibernate Annotations
Issue Type: New Feature
Affects Versions: 3.2.1
Environment: annotations version 3.2.1.ga, java 1.5
Reporter: Sabina Schneider
I am particulary interested in generating a oneToMany relationship, in which the source
table column does NOT contain a unique constraint. Nevertheless, specifying the
referencedColumnName creates a unique constraint. How can I avoid this? This is the code:
@OneToMany(targetEntity = AppleGenre.class, fetch=FetchType.LAZY)
@LazyCollection(LazyCollectionOption.EXTRA)
@JoinTable(name = "APPLE_FEATURE",
joinColumns = { @JoinColumn(name = "APPLEID",
referencedColumnName="APPLE_ID",
unique=false, nullable=false, insertable=false, updatable=false ) },
inverseJoinColumns = { @JoinColumn(name = "WORD",
referencedColumnName="APPLEGENREID ",
unique=false, nullable=false, insertable=false, updatable=false) }
)
public List<SoftGenre> getSoftGenres(){
return softGenres;
}
APPLE_ID is NOT unique and APPLEGENREID is PK of AppleGenre
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: