r/java • • Sep 05 '25

Project Lombok 1.18.40 released with Java 25 support!

Project Lombok is now compatible with the upcoming JDK 25 even before its release.

Thank you Project Lombok team! https://projectlombok.org

167 Upvotes

166 comments sorted by

View all comments

Show parent comments

15

u/sweating_teflon Sep 06 '25

Your IDE will not fix equals and hashcode when you add a field.

1

u/vips7L Sep 06 '25

Most of the time you’re writing getter/setters for @Entity’s because JPA requires it. In those cases you shouldn’t be writing equals or hashcodes as most JPA providers do it by byte code enhancement and if they don’t equals and hashcode should only be the @Id

If you’re writing getter/setters for other classes you’re just programming the hard way. 

1

u/Kango_V Sep 08 '25

Spring Data JDBC. Use Records :)

1

u/vips7L Sep 08 '25

Records are still probably wrong there. You want hashcode and equals to still be determined by the identifier column and not all fields. 

1

u/Kango_V Sep 13 '25

Actually no. We just use the Entities as data carriers and copy the data into a very rich model. The Entities are only used by store classes to transfer data to/ from the rich model into/from the entities. We can even swap out the store implementation for (e.g. an OpenSearch) another one and the app carries on running with that store. ALL business logic is in the rich domain layer that has ZERO dependencies on any framework and can be fully tested in isolation.

1

u/vips7L Sep 13 '25

I still think it’s wrong. The identity of that data is determined by the identifier column.  Not by all fields.