From struts-user-return-18108-apmail-jakarta-struts-user-archive=jakarta.apache.org@jakarta.apache.org Tue Oct 02 04:24:07 2001 Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 75265 invoked by uid 500); 2 Oct 2001 04:24:07 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: struts-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 75258 invoked from network); 2 Oct 2001 04:24:07 -0000 Received: from femail13.sdc1.sfba.home.com (24.0.95.140) by daedalus.apache.org with SMTP; 2 Oct 2001 04:24:07 -0000 Received: from cn93055 ([24.40.60.144]) by femail13.sdc1.sfba.home.com (InterMail vM.4.01.03.20 201-229-121-120-20010223) with SMTP id <20011002042410.LDGN18139.femail13.sdc1.sfba.home.com@cn93055>; Mon, 1 Oct 2001 21:24:10 -0700 From: "Ali Ozoren" To: , "Christophe Marchand" Subject: RE: ejb design Date: Tue, 2 Oct 2001 00:22:32 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Importance: Normal In-Reply-To: <001801c14a5f$d5f55c20$321aa8c0@chmjava> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Well- I think I didn't explain myself well enough. I try again between the lines. -----Original Message----- From: Christophe Marchand [mailto:christophe.marchand@labodev.com] Sent: Monday, October 01, 2001 6:00 AM To: struts-user@jakarta.apache.org Subject: Re: ejb design Wrong idea ! EJB entity are made to "store" one and only one record or ValueObject. findByPrimaryKey entity method is designed to retrieve one record, depending on a primary key object. If you use only one entity class with a hashtable, you'll have a lot of problem to solve : 1 - your primary key object will be udge to store all data from all primary key from all value objects, 2 - your value objects wouldn't able to extend a primary key object (are be composed with) --- I am planning to return only one row from the db. But instead of attaching each column's value into a separate member variable, I am proposing to enter values into a hashtable. If there is more than one row in the resultset it can easily throw a TooManyRows exception, which should never happen. 3 - you will be obliged to use BMP (Bean managed persistance) entity beans, with many sql statements in, and it we'll be very difficult to maintain when you change your data model. --- I will use BMP but code won't change with structural changes since it builds the hashtable by looking at the specified table for that bean. So as soon as you add a field to table, it is ready to be accessed using getValue("newFieldName") call. 4 - if you decide in the future to split your database in two ones, and then to deploy on two different servers, you'll keep a lot of unused code in your classes (or you'll be obliged to re-write everything, both entity beans and client-side jndi calls...) Your solution is technically possible, but you are goi ng to spend a lot of nights to maintain this, for no gain... --- My solution is supposed to accomplish exact opposite. Less coding, less maintenance. Have a look at "Mastering EJB's" book, which is very interesting on ejb's design considerations... --- I have that. Ed Roman's. Excellent book IMHO. Thanks for the input, --a