Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 2225 invoked from network); 24 Oct 2007 03:13:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Oct 2007 03:13:34 -0000 Received: (qmail 67777 invoked by uid 500); 24 Oct 2007 03:13:19 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 67760 invoked by uid 500); 24 Oct 2007 03:13:19 -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 67749 invoked by uid 99); 24 Oct 2007 03:13:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Oct 2007 20:13:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of clinton.begin@gmail.com designates 209.85.198.187 as permitted sender) Received: from [209.85.198.187] (HELO rv-out-0910.google.com) (209.85.198.187) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2007 03:13:22 +0000 Received: by rv-out-0910.google.com with SMTP id c27so43675rvf for ; Tue, 23 Oct 2007 20:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; bh=Q56gOxaoOWaKGUd0ScFEUmk+ewn9mwIqcIDceCtrs8g=; b=Pt1cdBWwzs2mBArNaAqIoZGmJ+MeT6MyaP1Q1CJYfJseFHiNjVEHbYeuWe/iznhSTEwBYFDX6ez1xiwvdhLaZ5IR3q0McxdYeKKsTQ+nBrorUDmZhhNR/bI1K1N9NDI+WVYt7V2wmJ5W3QjNWOcLk6aPNxPw368IcJryy7CK7IA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; b=fiTONLX215Abps/hGLIerEdiOLQ5XAofbqZd0zSX/t5x0L/b/9KF4y7G1hoeQqjQFgu33lSBIgbjyTy8pU/dPoH4IwhdTeLHPZkDIqIxtyXjc9Njz8xsmphTmrfbXnUPTTvUQCwnOYyV/FG+HRsX134615+33dvbusa37SQ0M2k= Received: by 10.141.51.15 with SMTP id d15mr54718rvk.1193195580657; Tue, 23 Oct 2007 20:13:00 -0700 (PDT) Received: from DARKSTAR ( [24.66.195.100]) by mx.google.com with ESMTPS id b39sm455544rvf.2007.10.23.20.12.59 (version=SSLv3 cipher=OTHER); Tue, 23 Oct 2007 20:13:00 -0700 (PDT) From: "Clinton Begin" To: References: <471dfe4d.15b38c0a.7757.ffff95d8@mx.google.com> In-Reply-To: Subject: RE: question on com.ibatis.jpetstore.service.* Date: Tue, 23 Oct 2007 21:12:36 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcgV43VQa24mDnRSR3iEEmWGEykJlQAB/mSA Content-Language: en-ca Message-ID: <471eb83c.27b38c0a.09bd.1282@mx.google.com> X-Virus-Checked: Checked by ClamAV on apache.org Ack! If you're just starting out, don't use the DAO framework. :-) Use Spring or use your own simple classes for DAOs. They don't really need a framework. But yes, I'd instantiate the DAOs within the service. If you're already using the DAO framework, then the answer to both of your questions are: >>Do you have dao initialization (if you use dao) in MyService >>constructor? Something like this: Yes >>Is dao initialization cheap operation too? Yes >> Should I use singleton, No Cheers, Clinton -----Original Message----- From: Dmitry Neverov [mailto:neverov_dg@nkmk.ru] Sent: October-23-07 8:13 PM To: user-java@ibatis.apache.org Subject: Re: question on com.ibatis.jpetstore.service.* Thanks for answers! Do you have dao initialization (if you use dao) in MyService constructor? Something like this: private MyService(){ someDao = (SomeDao) daoManager.getDao(someDao.class); } Is dao initialization cheap operation too? Should I use singleton, if I use dao (to create new dao only once)? -- Best regards, Dmitri Neverov