Explicit constructor using Lombok?

That bit is contradictory you're right. I've not used Lombok before but with hibernate if you want to be able to create a bean and persist you need the default constructor as given above as far I was aware. It uses Constructor.newInstance() to instantiate new objects.

Here is some hibernate documentation which goes into more detail.

Hibernate Documentation


If you are using @Data with a @NonNull field and still want a noargs-constructor, you might wanna try to add all 3 annotation together

@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor

Apparently an old intelliJ bug which I did replicate in Eclipse Kepler and lombok v0.11.4


Have a look at @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor.

The constructor behavior of @Data is like @RequiredArgsConstructor:

@RequiredArgsConstructor generates a constructor with 1 parameter for each field that requires special handling. All final fields get a parameter, as well as any fields that are marked as @NonNull that aren't initialized where they are declared.

Given that none of your fields are either final or @NonNull, this will result in a no-argument constructor. However, this is not the most expressive way to achieve this behavior.

What you'll probably want in this case is a @NoArgsConstructor (optionally combined with a @AllArgsConstructor), to clearly communicate the intended behavior, as is also indicated in the documentation:

Certain java constructs, such as hibernate and the Service Provider Interface require a no-args constructor. This annotation is useful primarily in combination with either @Data or one of the other constructor generating annotations.