Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Record as Embeddable #2203

Closed
hantsy opened this issue Jul 7, 2024 · 1 comment
Closed

Support Record as Embeddable #2203

hantsy opened this issue Jul 7, 2024 · 1 comment

Comments

@hantsy
Copy link

hantsy commented Jul 7, 2024

I tried to use a record as @EmbeddedId id in an entity.

public record RecordEmbeddedId(String id, String id2) {
}

@Entity
public class RecordEmbeddedIdEntity {

    @EmbeddedId
    RecordEmbeddedId id;
    String name;

    // setters and getters
}

When running the testing codes to verify the record support, I got the following errors.

Exception Description: Predeployment of PersistenceUnit [defaultPU] failed.
Internal Exception: Exception [EclipseLink-7246] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The Entity class [class com.example.RecordEmbeddedIdEntity] has an embedded attribute [id] of type [class com.example.RecordEmbeddedId] which is NOT an Embeddabl
e class. Probable reason: missing @Embeddable or missing <embeddable> in orm.xml if metadata-complete = true. Please see server.log for more details. [status: CLIENT_ERROR reason: Bad Request]

If I add @Embeddable to record like this.

@Embeddable
public record RecordEmbeddedId(String id, String id2) {
}

Run the tests, it will throw the following exceptions.

Exception [EclipseLink-63] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance creation method [com.example.RecordEmbeddedId.<Default Constructor>], with no parameters, does not exist, or is not accessible.
Internal Exception: java.lang.NoSuchMethodException: com.example.RecordEmbeddedId.<init>()
Descriptor: RelationalDescriptor(com.example.RecordEmbeddedId --> [DatabaseTable(RECORDEMBEDDEDIDENTITY)])

To Reproduce
Steps/resources to reproduce the behavior:

@rfelcman
Copy link
Contributor

rfelcman commented Jul 8, 2024

Implementation is #2163
nightly build will be available tomorrow at
https://download.eclipse.org/rt/eclipselink/nightly/5.0.0/
or from Jakarta Maven staging repository
https://jakarta.oss.sonatype.org/content/groups/staging/org/eclipse/persistence/
e.g. latest snapshot org.eclipse.persistence:eclipselink
https://jakarta.oss.sonatype.org/content/groups/staging/org/eclipse/persistence/eclipselink/5.0.0-SNAPSHOT/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants