ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: Anemic Domain Model and iBatis
Date Wed, 04 Apr 2007 13:43:34 GMT
iBATIS now has a support for POJOs without getter and setter methods. I
believe the code is in svn.
iBATIS can now set properties directly. If my guessing is right, the
code do something like this.
if (!hasSetter(resultObject, propertyName) {
    Filed f = getField(resultObject, propertyName);
    f.set(resultObject, object);
This code gives the chance to use POJOs without getters and setters but
will not handle constructor with parameters (this is likely to be fixed
in version 3).
For more details about this behavior, ask Clinton!


From: Nathan Ward [mailto:nward@resqsoft.com] 
Sent: Wednesday, 04 April 2007 07:19
To: user-java@ibatis.apache.org
Subject: RE: Anemic Domain Model and iBatis

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

View raw message