4 ms·
Good answer. Also be careful with how you define OO object identity. Some ORMs cache in-memory objects (eg: lookup by id) and determine if an object is the same
by mping 9y ago
Good answer. Also be careful with how you define OO object identity. Some ORMs cache in-memory objects (eg: lookup by id) and determine if an object is the same through equals() implementation and hashCode().
IMHO ORMs are nice if you use a OO heavy language, and want to reuse ORM classes in your domain and/or as DTOs. The biggest gotcha is that you will have to understand the quirks of the ORM (N+1, lazy, object equality, eager vs. lazy, types of inheritance, pk generation, integration with legacy DBs, polymorphism, etc).
Some legacy DBs make it very hard to integrate with an ORM (eg: no PK, Composite PKs with weird PK generation, etc).