EclipseLink: Non compilable metamodel class generated with NotNull over byte fields present

Viewed 57

I have the following entity:

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;

@Entity
@Table(name = "authentication_certificate")

public class Certificate  {

    @Column(name = "body", nullable = false)
    @NotNull
    private byte[] body;

The generated metamodel class code is:

package bm.authentication;

import @javax.validation.constraints.NotNull byte;

import javax.annotation.processing.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;

@Generated(value="org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor", date="2020-11-20T16:29:34", comments="EclipseLink-2.7.6.v20200427-rNA")
@StaticMetamodel(Certificate.class)
public class Certificate_ extends UuidIdEntity_ {

    ...
    public static volatile SingularAttribute<Certificate, NotNull byte[]> body;
   ...

As you can see the generated lines

import @javax.validation.constraints.NotNull byte
..
    public static volatile SingularAttribute<Certificate, NotNull byte[]> body;

do not compile..

When I remove the @NotNull annotation the code generates correctly, but I lose the ability to use the Java validation API over these fields. I realized that the problem only happens for binary types I can leave the @notNull in other types of fields.

Some additional information that can be useful I am using EclipseLink-2.7.4/EclipseLink-2.7.6 as an import from fish.payara.extras/payara-embedded-all from Payara 5 as part of a migration from Payara 4. In the payara 4 code it works ok.

0 Answers
Related