[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4633) Using same table for multiple relations doesn't work
Kevin Schmidt (JIRA)
noreply at atlassian.com
Wed Dec 2 11:19:08 EST 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34846#action_34846 ]
Kevin Schmidt commented on HHH-4633:
------------------------------------
Adam,
I am seeing this same issue on the Hibernate 3.5 Beta 2. My situation that triggered this issue is slightly different, so I thought I would share it with you as a test case for this fix. Basically, given A and B, where A has two oneToMany relationships with B. These relationships use a SQL where condition to differentiate which B's belong in which collection in A. I will attach a runnable test case as well so that you can see exactly what I mean. But for now, here is the example that causes the duplicate mapping exception.
@Audited
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.NONE)
@Table(name = "ATable")
@AccessType("field")
@Proxy
public class ExampleTestClass {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "AnID")
private Long id;
@Column(name = "Text")
private String text;
@OneToMany
@JoinColumn(name = "AnIDToJoinOn")
@Where(clause = "Type = 1")
private Set<ChildOfExampleTestClass> childrenOfType1 = new HashSet<ChildOfExampleTestClass>();
@OneToMany
@JoinColumn(name = "AnIDToJoinOn")
@Where(clause = "Type = 1")
private Set<ChildOfExampleTestClass> childrenOfType2 = new HashSet<ChildOfExampleTestClass>();
}
@Audited
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.NONE)
@Table(name = "BTable")
@AccessType("field")
@Proxy
public class ChildOfExampleTestClass {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "AnID")
private Long id;
@Column(name = "Text")
private String text;
}
> Using same table for multiple relations doesn't work
> ----------------------------------------------------
>
> Key: HHH-4633
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4633
> Project: Hibernate Core
> Issue Type: Bug
> Components: envers
> Reporter: Adam Warski
> Assignee: Adam Warski
> Fix For: 3.5
>
>
--
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
More information about the hibernate-issues
mailing list