Adrian Crum-2 wrote: > > I don't know if this is the best approach, but it is the one I use. > Instead of extending the entity, I create a separate entity that contains > the additional fields. Then I connect the original entity and the new > entity together with a view entity. The CRUD services for the view entity > call the original entity's CRUD services first, and then call the new > entity's CRUD services. In this way I keep all custom entities and code > outside of the main project. >
While we typically extend the entities which works for us (we leverage the existing services implementations but usually do not leverage the existing presentment layer). One thing to consider is if your extension really represents a sub-class of the parent entity (think Person/PartyGroup extending Party) you could make use of an additional type with the "hasTable" attribute set to Y. One enhancement that would be nice is the ability to have Ofbiz understand entity inheritance and perform table joins under the covers (aka standard ORM tools like Hibernate). -- View this message in context: http://n4.nabble.com/What-s-the-best-approach-for-custom-fields-attributes-vs-extending-entities-tp1747938p1748168.html Sent from the OFBiz - User mailing list archive at Nabble.com.
