iboyko / gradle-plugins

Gradle plugin for JPA Metamodel generation
Apache License 2.0
17 stars 7 forks source link

Problem with sping-boot 2.0.X and @NotNull on byte[] #23

Open aviaur opened 6 years ago

aviaur commented 6 years ago

Hi I have an entity contains a file data (byte[]) like this :

@Entity
@Table(name = "uploaded_file")
public class UploadedFile extends BaseUploadedFile {
    @NotNull
    @Lob
    private byte[] data;
......

When I did the generation of JPA Model in my project with spring-boot 1.5.X and hibernate 5.2.17, it was OK.

But when I do the generation in the same project with spring-boot 2.0.6 and hibernate 5.2.17, I have Exceptions because it generate this file :

import (@javax.validation.constraints.NotNull :: byte);
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;

@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(UploadedFile.class)
public abstract class UploadedFile_ extends uploadedFile.BaseUploadedFile_ {

    public static volatile SingularAttribute<UploadedFile, NotNull :: byte)[]> data;

}

I don't understand why the NotNull is added just with the type byte[] (never with others types) ? When I comment the @NotNull, it's work fine...

aviaur commented 6 years ago

Ok I find it's closed in the future hibernate 5.2.18 (But when...)

https://hibernate.atlassian.net/browse/HHH-12612?jql=project%20%3D%20HHH%20AND%20component%20%3D%20hibernate-jpamodelgen