Bug 347158 - Cascade persist on child with joined table fails
Summary: Cascade persist on child with joined table fails
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 10:07 EDT by John Howard CLA
Modified: 2022-06-09 10:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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