You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by ra...@wipro.com on 2006/04/11 17:32:33 UTC

Urgent help needed - Ibatis Complex Properties



Hi ,

I am new to IBatis. Actually my requirement is  to fetch the data from
multiple tables and store it in a single business object.

These are my classes:

User
{
      // Static properties

    private int  id,

   private String name;

  // Dynamic Properties

   List DynamicProperties;

///and this class also contains   getters and setters for setting all
the properties.

}

The User.java class holds both the static properties and dynamic
properties.

The static properties are stored in USR_DETAILS table.

The DynamicProperties are stored in USR_PROPERTIES table.

DynamicProperties
{
    private int userId;
    private String propertyName;
    private String propertyValue;

    //  getters and setters for both propertyName and propertyValue
}

It is possible that one user can have multiple properties.

How can I get the data from both the tables and store it to User Object.

The following is the query which I am using.

select * from USR_DETAILS, USR_PROPERTIES  where USR_DETAILS.USR_ID =
USR_PROPERTIES.USR_ID;


How do i specify the multiple result classes or give me select query.


Regards,
Rambabu







The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Urgent help needed - Ibatis Complex Properties

Posted by Jeff Butler <je...@gmail.com>.
For this you should use iBATIS' group by support.  There are some examples
here:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+around+the+N+Plus+1+selects+problem

Jeff Butler

On 4/11/06, rambabu.piridi@wipro.com <ra...@wipro.com> wrote:
>
>
>
>   Hi ,
>
> I am new to IBatis. Actually my requirement is  to fetch the data from
> multiple tables and store it in a single business object.
>
> These are my classes:
>
> User
> {
>       // *Static properties*
>
>     private int  id,
>
>    private String name;
>
>   // *Dynamic Properties*
> **
>    List DynamicProperties;
>
> ///and this class also contains   getters and setters for setting all the
> properties.
>
> }
>
> The User.java class holds both the static properties and dynamic
> properties.
>
> The static properties are stored in USR_DETAILS table.
>
> The DynamicProperties are stored in USR_PROPERTIES table.
>
> DynamicProperties
> {
>     private int userId;
>     private String propertyName;
>     private String propertyValue;
>
>     //  getters and setters for both propertyName and propertyValue
> }
>
> It is possible that one user can have multiple properties.
>
> How can I get the data from both the tables and store it to User Object.
>
> The following is the query which I am using.
>
> select * from USR_DETAILS, USR_PROPERTIES  where USR_DETAILS.USR_ID =
> USR_PROPERTIES.USR_ID;
>
>   How do i specify the multiple result classes or give me select query.
>
>
> Regards,
> Rambabu
>
>
>
>
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>