public class OneToManyHHH5836Test extends BaseCoreFunctionalTestCase {
@Test
public void testMappingWithSameNameFails() {
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {Company.class, Person.class, EmailAddress.class};
}
@Entity
@Table(name = "company")
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "company_id_seq", allocationSize = 1)
public static class Company {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
private Long id = null;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "recipient_id", nullable = false)
List<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
}
@Entity
@Table(name = "person")
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "person_id_seq", allocationSize = 1)
public static class Person {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
private Long id = null;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "recipient_id", nullable = false)
List<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
}
@Entity
@Table(name = "email_address")
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "email_address_id_seq", allocationSize = 1)
public class EmailAddress {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
private Long id = null;
@Column(name = "adress")
String address = null;
}
}