--- Colin Williams <[EMAIL PROTECTED]>
wrote:
> Is there a way to index my POJOs without running
> another SQL statement
> similar to the way it is done in Hibernate?
> eg
>
> All my POJOs have an object that acts as the key for
> the object, called id
>
> currently I generate this in Ibatis by defining
> another SQL statement
> to retrieve the id field
>
>
> <resultMap id="getCustomerResult" class="customer">
> <result property="id"
> column="{account=ACCOUNT,branch=BRANCH}"
> select="getCustomerId"/>
> <result property="email" column="email"/>
> </resultMap>
>
> but this also means that for every record I retrieve
> from the relevant
> file i must run another SQL statement to generate
> the id.
>
> Is there any way in Ibatis to do this without
> running another SQL Statement
> eg in Hibernate
> <composite-id name="id" class="CustomerKey">
> <key-property name="account" type="long"
> column="ACCOUNT"/>
> <key-property name="branch" type="long"
> column="BRANCH"/>
> </composite-id>
>
> will take the values from the fields ACCOUNT and
> BRANCH and use them
> to construct a CustomerKey object
Colin,
Have you had a look in the developer's guide under the
heading, "Avoiding N+1 Selects (1:1)"? I think you
can use the same recipe to solve your problem...
HTH,
Kris
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com