Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347158

Summary: Cascade persist on child with joined table fails
Product: z_Archived Reporter: John Howard <john.howard9>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Howard CLA 2011-05-25 10:07:47 EDT
@Entity
@Table(name = "ENTITY_A")
Class A {
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "B_FK")
	// @Transient
	private B b;
}

@Entity
@DiscriminatorValue(value = "Y")
@PrimaryKeyJoinColumn(name = "C_PK")
@Table(name = "ENTITY_B")
Class B extends Class C {
}


@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "TYPE_IND")
@DiscriminatorValue(value = "N")
@Table(name = "ENTITY_C")
Class C {
	@Id
	@GeneratedValue(generator = "ECLIPSELINK_SEQUENCE")
	@SequenceGenerator(name = "ECLIPSELINK_SEQUENCE", sequenceName = "ECLIPSELINK_SEQUENCE", allocationSize = 200)
	@Column(name = "C_PK")
	private Long id;
}

Persisting A appears to work but subsequent flushes result in
EclipseLink-4002 integrity constraint violated - parent key not found

This code worked in EclipseLink 2.0.2

There is a work around, which is to persist B before persisting A.
Comment 1 Tom Ware CLA 2011-06-09 10:05:07 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:09:14 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:15:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink