2014-03-09 18:31 GMT+01:00 Steve Ebersole <steve(a)hibernate.org>:
@Entity
interface Employee {
...
}
2) We'd dynamically generate a class to back this. This generated class
can contain many of the performance tweaks we've been developing via
bytecode extensions (inline dirty-checking, "entity entry" info, etc).
In which situation would one make use of this? This seems to encourage
"anemic data models", i.e. entities which are just data holders but don't
contain any business logic. Often it's very useful though to add logic
dealing with an entity's state to the entity type itself.
Will the class be generated at build or runtime? In case of the latter, how
would one instantiate such entity?
On a somewhat related note, I've been contemplating the notion of
"partially mapped entities" in OGM [1]. Those would provide explicit
properties only for some attributes (common ones, or ones which business
logic relates to), while others would be exposed via a generic map
structure:
@Entity
public class Product {
@Id
private long id;
private String name;
private BigDecimal price;
@AdditionalProperties
private Map<String, Object> additionalProperties;
// ...
}
This would be very beneficial for NoSQL use cases where you want to pass
through data from the store to a GUI in a generic manner or during
prototyping/rapid development, where you manifest more and more attributes
as explicit properties, just as business logic requires it.
--Gunnar
[1]
https://hibernate.atlassian.net/browse/OGM-470
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev