Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, I don't like JPA because of lack of support of immutable types (records or my own classes that don't have setters, only constructor).

If you have data class with more than 5 fields then you have it wrong. Builders are like lombok and like field injection: hide poor class design.

If using a class hurts, it is badly designed and should hurt until it is refactored/split up into consumable parts.

I use records extensively, but those are in most cases converted classes which were small and immutable. JPA being one of the exceptions (a stuck in the past spec)



Some of database tables I worked with had over 100 columns.


I don't think you need to map all of them to a single object - projections work well here.

There are very few cases where you need to work simultaneously on that many columns.


I can't imagine other way of dealing with database rather than using a single class per table. Projections are a way to optimize some niche queries which are too slow otherwise.


A 100 column table will be slow either way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: