Larry,
The reason I ask is because my Fruit object actually
contains very important inner objects which must be
retrieved too.
class Fruit {
Skin s;
Color c;
Producer p;
}
These are retrieved everytime and are very important
to the application. I have independent sqlMap selects
which are selectSkin, selectColor, and selectProducer
when I need them as stand-alone objects.
However, when I have to write out all the column names
to retrieve (that's my SQL standard) for all Fruit,
Skin, Color, and Producer -- it sort of makes me
wrench. I love the whole idea that I can reuse my
sqlmap results, but I really don't like the idea that
I have to list out my columns (again): Hibernate would
excel at this task.
What do you think? Am I on track with my commentary or
can you enlighten me with anything further?
THANKS!
--- Larry Meadors <[EMAIL PROTECTED]> wrote:
> I generally name my key fields uniquely, but leave
> the others what
> they are, for example:
>
> create table Fruit (
> fruitId int,
> name varchar(30)
> )
>
> Then if I join to another table with a "name" field,
> I alias them to
> include the table name (so, in this case i would use
> "fruitName").
>
> That said..it really does not matter for the N+1
> selects solution,
> becuase it relies on the property names, not the
> field names. :-)
>
> Larry
>
>
> On 11/1/05, Paul Benedict <[EMAIL PROTECTED]>
> wrote:
> > Maybe someone has encountered this problem and
> would
> > like to lend a hand.
> >
> > Many of the tables that I have have column names
> that
> > are not unique across tables. At the moment, I
> have
> > taken the solution to rename each column in my
> query
> > and each resultMap knows what to look for:
> >
> > <resultMap id="fruitMap" class="Fruit">
> > <result property="id" column="f_id"/>
> > <result property="name" column="f_name"/>
> > </resultMap>
> >
> > So I have the convention that any columns from the
> > Fruit table will be returned as f_, anything from
> the
> > Vegetables column be v_, etc. This then allows me
> to
> > query multiple tables when solving the N+1 problem
> and
> > not get things confused.
> >
> > But is there a better way?
> >
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com