[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=all ]
Emmanuel Bernard updated ANN-7:
-------------------------------
Component: documentation
(was: binder)
Fix Version: 3.2.0
Document usage of @IndexColumn in one-to-many with indexed
collection
---------------------------------------------------------------------
Key: ANN-7
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-7
Project: Hibernate Annotations
Type: Improvement
Components: documentation
Versions: 3.2.0.cr1
Environment: Hibernate 3.0.5, Hibernate Annotations 3.0 beta2 preview, HSQL DB
Reporter: Ronald Wildenberg
Assignee: Emmanuel Bernard
Priority: Minor
Fix For: 3.2.0
I have a mapping for a List that does not result in the index column of the database
table to be filled.
@Entity
public class A {
@OneToMany(mappedBy = "a")
@Cascade(value = CascadeType.SAVE_UPDATE)
@IndexColumn(name = "index", base = 0)
public List<B> getBs() {
return bs;
}
public void setBs(List<B> bs) {
this.bs = bs;
}
}
@Entity
public class B {
@ManyToOne(optional = false)
@JoinColumn(name = "a_id")
public A getA() {
return a;
}
public void setA(A a) {
this.a = a;
}
}
Using this mapping, the 'index' column for table B is never filled if I add B
objects to A and save them.
The weird thing is, if I change the mapping for getBs to the following:
@OneToMany
@Cascade(value = CascadeType.SAVE_UPDATE)
@IndexColumn(name = "index", base = 0)
an association table is created with columns a_id, b_id, index. The only change I made is
removing the mappedBy attribute. This association table is not necessary, since an index
column can be added to table B.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira