Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 78861 invoked from network); 4 Apr 2007 13:44:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2007 13:44:02 -0000 Received: (qmail 15792 invoked by uid 500); 4 Apr 2007 13:44:06 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 15777 invoked by uid 500); 4 Apr 2007 13:44:06 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 15766 invoked by uid 99); 4 Apr 2007 13:44:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 06:44:05 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of Christian.Poitras@ircm.qc.ca designates 207.162.51.27 as permitted sender) Received: from [207.162.51.27] (HELO pandore.ircm.qc.ca) (207.162.51.27) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 06:43:56 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C776BF.3D841677" Subject: RE: Anemic Domain Model and iBatis Date: Wed, 4 Apr 2007 09:43:34 -0400 Message-ID: <5820E7E2A928DB46824297946AC2024A9A6208@pandore.ircm.priv> In-Reply-To: <004201c776ab$09d752a0$6400a8c0@nwardlt> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Anemic Domain Model and iBatis Thread-Index: Acd1Kg/2rv+rXzeZS+qyG7Azdh2k2gAPPSAQAFDOTiAABORzIA== References: <20070402132207.9600710FB02B@herse.apache.org> <7E4302A18925394BAC32C7AD1ABE75D4017BF28D@CNET6.cnet.cnwk> <004201c776ab$09d752a0$6400a8c0@nwardlt> From: "Poitras Christian" To: X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C776BF.3D841677 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable 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 =3D getField(resultObject, propertyName); f.setAccessible(true); f.set(resultObject, object); } =20 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! =20 Christian ________________________________ From: Nathan Ward [mailto:nward@resqsoft.com]=20 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.=20 ________________________________ From: Daniel Pitts [mailto:Daniel.Pitts@cnet.com]=20 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. =20 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. =20 ________________________________ From: Cihat.altuntas [mailto:cihat.altuntas@erenetyazilim.com]=20 Sent: Monday, April 02, 2007 6:20 AM To: user-java@ibatis.apache.org Subject: Anemic Domain Model and iBatis =09 =09 What do you think about iBatis POJOs and Anemic Domain model that martin fowler describes :=20 http://www.martinfowler.com/bliki/AnemicDomainModel.html 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? ------_=_NextPart_001_01C776BF.3D841677 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
iBATIS now has a support for POJOs without = getter and=20 setter methods. I believe the code is in svn.
iBATIS can now set properties directly. If my = guessing is=20 right, the code do something like this.
if (!hasSetter(resultObject, propertyName)=20 {
    Filed f =3D = getField(resultObject,=20 propertyName);
   =20 f.setAccessible(true);
    f.set(resultObject,=20 object);
}
 
This=20 code gives the chance to use POJOs without getters and setters but will = not=20 handle constructor with parameters (this is likely to be fixed in = version=20 3).
For=20 more details about this behavior, ask Clinton!
 
Christian


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

Both iBATIS and Hibernate support a rich object = model. You=20 don't have to map foreign key fields in a database to primitive type = fields,=20 such as String or Integer, on business objects. You an specify in iBATIS = mapping=20 files that these fields are used to create "complex properties" as = iBATIS=20 documentation calls it. In other words, you can configure iBATIS or = Hibernate=20 load Person objects that have an association to a Company (e.g.=20 myPerson.getCompany().getName()) even though the Person table has a = company_id=20 field in the database. The Person class does not have to have a = companyId field=20 (e.g. myPerson.getCompanyId()) although you can do that as well if you = want to.=20


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

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


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

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

http://www.martinfowler.com/bliki/AnemicDomainModel.html

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

------_=_NextPart_001_01C776BF.3D841677--