From: James C. (JIRA) <no...@at...> - 2006-07-13 12:45:08
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=comments#action_23619 ] James Carman commented on ANN-7: -------------------------------- Why was this issue closed without fixing the problem? This is not an obvious solution. I was working for hours trying to figure out why my index column of my list property was not getting inserted (the generated insert sql doesn't even have the index column in it). This should be reopened and addressed. > @IndexColumn does not result in valid index column > -------------------------------------------------- > > Key: ANN-7 > URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-7 > Project: Hibernate Annotations > Type: Bug > Components: binder > Versions: 3.1beta3 > Environment: Hibernate 3.0.5, Hibernate Annotations 3.0 beta2 preview, HSQL DB > Reporter: Ronald Wildenberg > > > 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 |