From: Christian B. (JIRA) <no...@at...> - 2006-07-24 23:42:13
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=comments#action_23754 ] Christian Bauer commented on ANN-7: ----------------------------------- That was one of the problems we knew would happen with modularization. For now the best we can do is trying to find the most important issues (all over again) and to add at least references. Later on (in a year or so) we might be able to merge the documentation. > 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 |