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

> could produce much better results by focusing your energies on learning the database instead of learning hibernate.

Completely false IME. If you put the same amount of effort into learning Hibernate you'll get a much bigger return.



Is there a way to avoid anemic domain model? Or have a proper invariant entity class that is created using constructor?


No. I see that as a reflection of the reality of the database; if your database contains rows that violate your domain invariants, what would you expect to happen?


It may not be a bad idea to fail fast by ORM calling the constructor (same way as Jackson does it when parsing JSON). Broken invariants may propagate and cross system boundaries making things much worse (I have seen a case, when $200M transaction was rolled back in 19 systems because data was not properly validated at entry - it was a crazy day for everyone in production support).


I hope application to break as soon as possible so everyone will be on board to fix it.




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

Search: