Lombok supported in studio?

Is lombok supported?

I tried creatina a simple entity, with @getters and @setters annotation.

The app was compiled, screens generated, etc., but at runtime I’ve got a “missing getter” error.
Adding manually getters and setters in the code solved the problem, so it seems that lombok was ignored.

We don’t test Jmix with Lombok, so we don’t recommend using it in Jmix projects.

Regards,
Konstantin

I think cuba gradle plugin enhanced entity class before lombok add getter to it, so you get this error. Maybe you can control the order

Add the following dependency into your build.gradle

compileOnly 'org.projectlombok:lombok:1.18.22’
annotationProcessor 'org.projectlombok:lombok:1.18.22’
testCompileOnly 'org.projectlombok:lombok:1.18.22’
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22’

I have already used lombok’s @Data on entity like below which saves me many getter and setter code!

@Data
@JmixEntity
@Table(name = “T_APP_Enable”)
@Entity
public class TAppEnable {
@Id
@Column(name = “IDENTIFIER”, nullable = false, length = 100)
private String identifier;
@InstanceName
@Column(name = “NAME”, length = 100)
private String name;
}

1 Like

FYI
Jmix team doesn’t recommend using @Data with any JPA entities, even outside of Jmix.
For reasons described in this article: Lombok and JPA: What may go wrong?

2 Likes

Hi,

Just as a side note: for all non JPA entity classes in a Jmix project it is perfectly possible to use Lombok. So any kind of POJO either for data transfer or for internal abstractions within business logic is not affected by this limitation.

Cheers
Mario

Thanks to everybody. I found the automatic creation of getters/setters in IDEA a handy replacement