From: <no...@at...> - 2005-07-07 07:52:59
|
The following comment has been added to this issue: Author: Ronald Wildenberg Created: Thu, 7 Jul 2005 2:51 AM Body: Well, if I use @JoinColumn(insertable = false, updatable = false), my foreign key is never written to the database and this violates the null constraint I have on it (@ManyToOne(optional = false)). Removing the mappedBy attribute works, but then I get the additional join table between table a and table b. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=comments#action_18693 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/ANN-7 Here is an overview of the issue: --------------------------------------------------------------------- Key: ANN-7 Summary: @IndexColumn does not result in valid index column Type: Bug Status: Closed Priority: Major Resolution: REJECTED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate Annotations Components: binder Versions: 3.1beta3 Assignee: Reporter: Ronald Wildenberg Created: Thu, 30 Jun 2005 10:50 AM Updated: Thu, 7 Jul 2005 2:51 AM Environment: Hibernate 3.0.5, Hibernate Annotations 3.0 beta2 preview, HSQL DB Description: 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. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |