ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Ward" <nw...@resqsoft.com>
Subject RE: Anemic Domain Model and iBatis
Date Wed, 04 Apr 2007 11:18:55 GMT
Both iBATIS and Hibernate support a rich object model. You don't have to map
foreign key fields in a database to primitive type fields, such as String or
Integer, on business objects. You an specify in iBATIS mapping files that
these fields are used to create "complex properties" as iBATIS documentation
calls it. In other words, you can configure iBATIS or Hibernate load Person
objects that have an association to a Company (e.g.
myPerson.getCompany().getName()) even though the Person table has a
company_id field in the database. The Person class does not have to have a
companyId field (e.g. myPerson.getCompanyId()) although you can do that as
well if you want to. 


From: Daniel Pitts [mailto:Daniel.Pitts@cnet.com] 
Sent: Monday, April 02, 2007 4:44 PM
To: user-java@ibatis.apache.org; Cihat.altuntas
Subject: RE: Anemic Domain Model and iBatis

This is something I've often thought about in regards to ANY ORM. iBATIS and
Hibernate.  I've come up with two solutions.
One, add behavior to your POJOs, and ask that consumers of your classes
don't use the getters/setters which iBATIS uses.
Two, Create behavior rich classes which hold/own the data-only POJOs.  The
data-only POJO's contained are the implementation details of the behavior
rich objects. In other words, treat your persisted data as primitives, and
wrap them appropriately.
There may be a third possibility, but I don't know how well iBATIS (or
Hibernate) would handle it... Have the persistence read/write otherwise
hidden data, and have the POJOs implement the domain logic normally, without
regards to persistence.


From: Cihat.altuntas [mailto:cihat.altuntas@erenetyazilim.com] 
Sent: Monday, April 02, 2007 6:20 AM
To: user-java@ibatis.apache.org
Subject: Anemic Domain Model and iBatis

What do you think about iBatis POJOs and Anemic Domain model that martin
fowler describes : 


iBatis uses POJOs like anemic domain model. Most of the classes only have
getter and setter methods. Is this domain model or just DTO or Value
Objects? Where do you put your core domain logic ? is iBatis suaitable for
Rich Domain models? I want to see your opinions about this subject?

View raw message