Yes sure but where would I do that? If I've got a complete DB access & object-relation mapping package between my business classes and my database, then I would have to write a whole new seperate bunch of classes to handle COUNT(*)s queries.
I was hoping somebody who uses such a package could tell me how they do it. Perhaps there's some way of specifying it in the mapping definitions that I haven't found yet. I haven't chosen a mapping package yet, so I'm not in that deep. Adam daniele rizzi wrote: >Hi Adam, >I know it sounds silly as an answer, but if you avoid OO altogether >for this sort of questions and >SELECT COUNT(*) FROM MY_TABLE >straight to the db? > >d.rizzi > > >-----Messaggio originale----- >Da: Adam Hardy [mailto:[EMAIL PROTECTED]] >Inviato: venerdi 31 maggio 2002 10.01 >A: Struts Users Mailing List >Oggetto: Re: Design Advice - Relational Databases & Java Objects > > >There's still one question I've got about using object - relational >mapping & DB access packages: > >what happens when I want to pull out a COUNT(*) on a grouping in the >database? For instance when I want to show the number of people who've >voted on an online survey, or the number of replies to a message in an >online forum? How would I integrate that into the framework? Or would it >have to be seperate? > >Re the book at http://www.object-relational.com/object-relational.html : >I didn't get further than the document's table of contents, which is why >I didn't see that it was a book to purchase - at a cool $1800. That's a >pity. > > > >[EMAIL PROTECTED] wrote: > > > >>The link that I included in Chapter 6 actually has a >>cost associated with getting at that information. I >>believe it's quite severe. What these guys have done is >>to compare these 13 products from every angle imaginable >>and they are selling their findings. >> >>I mentioned that this link is beneficial only if your >>project had some serious funds and you wanted to be >>absolutely sure that you were picking the correct >>implementation. >> >>Unfortunately, applications have different requirements >>as well as resources available. No one solution is going >>to be the perfect one for all. I would prefer to buy an >>ORM solution, rather than building one, although I know >>that some developers feel the opposite way. >> >>Chuck >> >> >> >> >>>Oh boy, now I've got information overload! Fortunately there's a link in >>>Chuck Cavaness's book to an article reviewing & comparing some of them - >>>although strangely they include Forte for Java from Sun instead of JDO. >>>Well, I can see what I'm going to be doing this weekend. >>> >>>Regards >>>Adam >>> >>> >>> >>> >>>Steve Muench wrote: >>> >>> >>> >>> >>> >>>>Oracle's J2EE Framework "Business Components for Java" >>>>makes it very easy to read and write from collections >>>>of values objects (sourced from the database) with >>>>automatic interaction with business objects that >>>>centralize your business rules, and handles the OR mapping >>>>for your business objects. You pick the "shape" of >>>>the data you need in your view layer, and it implements >>>>all of the handlers for your value object collections >>>>and optionally makes the value objects in these >>>>collections transparently updateable, delegating >>>>changes back through your business object layer >>>>with no yucky code you have to write yourself. >>>> >>>>A whitepaper on all the capabilities is at: >>>> >>>>http://otn.oracle.com/products/jdev/htdocs/j2ee_bc4j.html >>>> >>>>If you've read the O'Reilly Struts book sample chapters >>>>on TheServerSide.com, basically all of the Model Layer things >>>>that Chuck describes in Chapter 6, "Struts Model Components" >>>>as necessary pieces for your working Struts-with-Database- >>>>and-Business-Logic application, the BC4J framework >>>>implements for you. You basically just tell it the >>>>tables you want to work with (for your BO layer), or >>>>forward generate those tables from a BO object model >>>>that you design, and then tell it what queries your >>>>view layer needs to perform. >>>> >>>>You don't need to write model layer plumbing code. >>>> >>>>-> Don't bother writing Value Object classes >>>> >>>>-> Don't bother writing JDBC code for queries >>>> >>>>-> Don't bother writing a class to expose your >>>> collections of value objects to the view layer >>>> >>>>All of these things are done for you. >>>> >>>>Plus, it works with any SQL database, not only Oracle. :-) >>>> >>>>I'm planning a whitepaper that specifically illustrates >>>>how to couple Struts with BC4J next. >>>> >>>>__________________________________________________________________ >>>>Steve Muench - Developer, Product Mgr, Java/XML Evangelist, Author >>>>Simplify J2EE and EJB Development with BC4J >>>>http://otn.oracle.com/products/jdev/htdocs/j2ee_bc4j.html >>>>Building Oracle XML Apps, www.oreilly.com/catalog/orxmlapp >>>>----- Original Message ----- >>>>From: <[EMAIL PROTECTED]> >>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >>>>Sent: Wednesday, May 29, 2002 6:44 PM >>>>Subject: Re: Design Advice - Relational Databases & Java Objects >>>> >>>> >>>>| >>>>| >>>>| >>>>| Adam - >>>>| >>>>| Have you looked at Torque from the Jakarta Tubine project? >>>>| >>>>| I haven't used it but have heard good things about it. It provides an >>>>| ability to perform O/R mapping using an XML configuration file - and >>>> >>>> >(as I > > >>>>| understand) it creates Java files for you that implement a peristence >>>>| layer. >>>>| >>>>| FWIW - >>>>| Kevin >>>>| >>>>| >>>>| >>>>| >>>>| Adam Hardy <[EMAIL PROTECTED]> on 05/29/2002 12:44:28 PM >>>>| >>>>| Please respond to "Struts Users Mailing List" >>>>| <[EMAIL PROTECTED]> >>>>| >>>>| To: Struts Users Mailing List <[EMAIL PROTECTED]> >>>>| cc: (bcc: Kevin Bedell/Systems/USHO/SunLife) >>>>| Subject: Design Advice - Relational Databases & Java Objects >>>>| >>>>| >>>>| Hi All, >>>>| >>>>| I saw this thread in the archives and I thought I'd pinch the title. >>>>| I've spent this afternoon surfing the web looking at stuff on Sun, >>>>| Jakarta and lots of smaller sites looking for a ready-made data access >>>>| layer package but I take it there isn't an open-source one out there. >>>>| >>>>| Obviously I don't want to tie my data access layer to struts, so there >>>>| are a few questions I've got. >>>>| >>>>| (1) Is it best for the data access layer to throw exceptions on error >>>> >>>> >to > > >>>>| be picked up by the business objects & then struts actions, or would it >>>>| be good to use a struts-type message object and use strings in the >>>>| application resources file (I'm just worried my exceptions' text would >>>>| not be multi-lingual) >>>>| >>>>| (2) How would I get the database connection info to the data access >>>>| layer? Presuming I want to set it up in struts-config.xml or as in >>>>| commons-dbcp, would I then pass it in from struts actions into the >>>>| business object and then into the data access layer as a parameter on >>>>| each call? >>>>| >>>>| >>>>| >>>>| I've seen quite a few patterns like www.martinfowler.com and code like >>>>| in Sun's Pet Store, so I think I've got a fairly good idea of what I >>>>| need. The data access layer I want has got to: >>>>| >>>>| - take as input and return as output Data Transport Objects >>>>| - allow the business objects to control transactions >>>>| - use a connection pool >>>>| - possibly keep the SQL statements in an external XML file >>>>| - have comprehensive error handling & reporting >>>>| >>>>| >>>>| >>>>| >>>>| -- >>>>| To unsubscribe, e-mail: < >>>>| mailto:[EMAIL PROTECTED]> >>>>| For additional commands, e-mail: < >>>>| mailto:[EMAIL PROTECTED]> >>>>| >>>>| >>>>| >>>>| >>>>| >>>>| >>>>| >>>>| ----------------------------------------------------------------------- >>>> >>>> >---- > > >>>>| This e-mail message (including attachments, if any) is intended for the >>>> >>>> >use > > >>>>| of the individual or entity to which it is addressed and may contain >>>>| information that is privileged, proprietary , confidential and exempt >>>> >>>> >from > > >>>>| disclosure. If you are not the intended recipient, you are notified >>>> >>>> >that > > >>>>| any dissemination, distribution or copying of this communication is >>>>| strictly prohibited. If you have received this communication in error, >>>>| please notify the sender and erase this e-mail message immediately. >>>>| ----------------------------------------------------------------------- >>>> >>>> >---- > > >>>>| >>>>| >>>>| -- >>>>| To unsubscribe, e-mail: >>>> >>>> ><mailto:[EMAIL PROTECTED]> > > >>>>| For additional commands, e-mail: >>>> >>>> ><mailto:[EMAIL PROTECTED]> > > >>>>| >>>>| >>>> >>>> >>>>-- >>>>To unsubscribe, e-mail: >>>> >>>> ><mailto:[EMAIL PROTECTED]> > > >>>>For additional commands, e-mail: >>>> >>>> ><mailto:[EMAIL PROTECTED]> > > >>>> >>>> >>>> >>>> >>>> >>>> >>>-- >>>To unsubscribe, e-mail: >>> >>> ><mailto:[EMAIL PROTECTED]> > > >>>For additional commands, e-mail: >>> >>> ><mailto:[EMAIL PROTECTED]> > > >>> >>> >>> >>-- >>To unsubscribe, e-mail: >> >> ><mailto:[EMAIL PROTECTED]> > > >>For additional commands, e-mail: >> >> ><mailto:[EMAIL PROTECTED]> > > >> >> >> >> > > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> > > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>