Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing Lombok #251

Open
arey opened this issue Dec 28, 2023 · 4 comments
Open

Consider removing Lombok #251

arey opened this issue Dec 28, 2023 · 4 comments
Assignees

Comments

@arey
Copy link
Member

arey commented Dec 28, 2023

Now that the application is based on Java 17, we could consider removing Lombok and using the Record instead.

@shobhakamath
Copy link
Contributor

Can I take this task?

@arey
Copy link
Member Author

arey commented Dec 29, 2023

Yes, sure @shobhakamath
I'm not sure removing Lombok without adding boilerplate code is possible anywhere. But you could try by submitting small pull request

@bastiat
Copy link

bastiat commented Dec 29, 2023

I'm afraid it won't be possible to use records for Jpa @ Entity'ies.
My concern is https://vladmihalcea.com/java-records-jpa-hibernate/

Can Java Records be used as JPA or Hibernate entities?
One very common question is if Java records are going to simplify the way we are building JPA or Hibernate entities. And, the answer is no. They will not.

According to the JPA specification, an entity must follow these requirements:

the entity class needs to be non-final,
the entity class needs to have a no-arg constructor that is either public or protected,
the entity attributes must be non-final.
However, as explained by this article, the Java Record type is defined like this:

the associated Java class is final,
there is only one constructor that takes all attributes,
the Java record attributes are final.
So, according to the JPA specifications, a Java Record cannot be used as an entity.

@arey
Copy link
Member Author

arey commented Dec 29, 2023

You're right @bastiat
For JPA entities we could not use record but we could generate getters/setters with IDE
In this repository, Lombok is also used by DTO, Service and Controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants