Hi,
#www .data-ware.it
we often use lombok in our rest projects
#https://projectlombok.org/
to let code be more easy to read.
why dont you integrate lombok ?
you could remove al get and set methods in the entity declaration.
I think you already know the lombok library.
So I’m courious to know why you dont use it
regards
Stefano
mbucan
(Mladen Bucan)
July 2, 2024, 3:34pm
2
Hello,
would this work? I haven’t tried it myself.
Kind regards,
Mladen
Yes it works!
very well.
I use it since 6 years more or less …
example:
// www.data-ware.it
package it.dataware.test.model.entities;
import lombok.Data;
import org.checkerframework.checker.units.qual.Length;
import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
import javax.persistence.*;
import java.io.Serializable;
@Data
@Entity
@Table (name = “Countries”)
public class Country implements Serializable {
@Id
@Column (name = “CodeISO”, insertable = false, updatable = false, length = 2)
@Generated (GenerationTime.INSERT)
private String id;
@Column(name = "Name", length = 50)
private String nome;
}
get & set of attributes are generate automatically.
krivopustov
(Konstantin Krivopustov)
July 5, 2024, 9:33am
4
Please never use @Data for Jmix entities. It will prevent correct generation of equals/hashCode methods by entity enhancement .
See also Lombok and JPA: What Could Go Wrong? - DZone
Regards,
Konstantin
2 Likes
ok. I dont use it in JMix.
the question is why Jmix (developers) cannot use Lombok ?
krivopustov
(Konstantin Krivopustov)
July 8, 2024, 11:54am
6
In fact you can. Just at your own risk, we don’t test this.
1 Like
a.oblozhko
(Aleksey Oblozhko)
July 9, 2024, 10:32am
7
Lombok is often became the source of development workflow breaks and unexpected behaviour in code. This makes developers in love with IDE productivity features like code generartion with Alt+Insert menu:)
1 Like