2 ms·
> Every field is not writable in a database. There’s often constraints that restrict how fields can be updated. There are, but there's no metamodel that expose
by lmm 6y ago
> Every field is not writable in a database. There’s often constraints that restrict how fields can be updated.
There are, but there's no metamodel that exposes them. All you can do (in a generic/programmatic way) is attempt a write. A particular write may fail because of constraints, but this gives you no information (except in ad-hoc database-specific ways) about what kinds of writes might succeed.
> It’s the only way if you insist on having the entities track their own state changes via point in time snapshots. If they represent the changes themselves there’s no requirement for reflection.
Sure, but that creates a major impedance mismatch. In SQL databases the current state is first-class and changes are very much seccond-class.
> In the real world the lazy loaded view get tested with one widget loading five wozzles, then in production it’s one widget loading 5000 wozzles, each performing a separate query to hydrate its state.
Sure, and then you take 5 minutes and actually profile it, actually read a little bit of the hibernate documentation, and fix it. I find it strange how for most kinds of technology the accepted wisdom is that you should take a bit of time to understand its behaviour (indeed the article says as much regarding SQL), but for ORMs the conventional wisdom is that at the first sign of trouble you should throw the whole thing away.
> On the contrary, a well designed database can and will have many separate applications I retracting with it.
It shouldn't. You are virtually guaranteed to get deadlocks (even in a single application deadlocking is easy - you need to have clear rules about which things can be locked in which order and all queries need to abide by them), updating your schema becomes essentially impossible because you can never know what's using a given column or constraint, you can't make use of temporary tables because it won't be clear what owns or is responsible for them, validation has to be done in the database which makes it very difficult to unit test or deploy (and good luck getting your test environment to look like your prod environment if you have to co-ordinate between n different applications)...
> The complexity of learning SQL is grossly overstated.
The complexity of learning Hibernate/JPA is grossly overstated too. Seriously, it's not that hard if you actually try.