From: Christian B. (JIRA) <no...@at...> - 2006-07-24 21:39:14
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=all ] Christian Bauer updated ANN-7: ------------------------------ Summary: Document usage of @IndexColumn in one-to-many with indexed collection (was: @IndexColumn does not result in valid index column) type: Improvement (was: Bug) Version: 3.2.0.cr1 (was: 3.1beta3) Priority: Minor (was: Major) > 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: binder > 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 > > > 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.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |