Subject | Detailed information ==Problem in creating Stored Procedure === |
---|---|
Author | rambabu.piridi@wipro.com |
Post date | 2006-07-26T09:17:56Z |
Hi All,
I am getting the same result set even by using stored procedures also.
Actually my requirement is Like this.
I have two tables
UserInfo
======
user_id varchar(80) ** not an INTEGER, can be any
character string ***
user_name varchar(80)
password varchar(80)
The second table is
UserPropertyInfo
============
user_id varchar(80) Foreign Key UserInfo
property_name varchar(50)
property_value varchar(50)
the corresponding bean class is User.java
---------------------------------------------------------------
public class User
{
public String user_id;
public String user_name;
public String password;
public List listUserProperties;
// and the corresponding getters and setters.
}
I have one API which retrives the records between specified range from
the database.
Here I am using Ibatis as data mapper between firebird and java
classes.
public List getProperties(int fromRecord, int toRecord)
{
List list =
SqlMapClient.queryForList("selectUsersInRange",null,fromRecord,
toRecord);
}
Datatabase Data
=================
UserInfo
----------
userId userName password
===== ======= =======
ABC Test Test
DEF Test2 Test2
UserPropertyInfo
------------------------
userId propertyName propertyValue
==== ========== ==========
ABC City XXXX
ABC Country YYYY
DEF null null
Now my query should be able to take the parameters from the user and
shoul retrive
the users with in the specified range.
The query is
select FIRST n SKIP m * from UserInfo u left outer join
userPropertyInfo up on u.userId=up.userId;
when the user invoke the API - getPropertie(1,2)
The query is retriving
ABC Test Test City XXXX
ABC Test Test Country YYYY
but my requirement is regardless of how many properties the user has,
all properties should be displayed as a single row. So for the above
API, it should retrieve
ABC Test Test City XXXX Country
YYYY (The join should be displed in a single row instead of diferent
rows)
DEF Test2 Test2 null null
is this possible in Firebird.....
Thanks n Regards,
==============
Rambabu
[Non-text portions of this message have been removed]
I am getting the same result set even by using stored procedures also.
Actually my requirement is Like this.
I have two tables
UserInfo
======
user_id varchar(80) ** not an INTEGER, can be any
character string ***
user_name varchar(80)
password varchar(80)
The second table is
UserPropertyInfo
============
user_id varchar(80) Foreign Key UserInfo
property_name varchar(50)
property_value varchar(50)
the corresponding bean class is User.java
---------------------------------------------------------------
public class User
{
public String user_id;
public String user_name;
public String password;
public List listUserProperties;
// and the corresponding getters and setters.
}
I have one API which retrives the records between specified range from
the database.
Here I am using Ibatis as data mapper between firebird and java
classes.
public List getProperties(int fromRecord, int toRecord)
{
List list =
SqlMapClient.queryForList("selectUsersInRange",null,fromRecord,
toRecord);
}
Datatabase Data
=================
UserInfo
----------
userId userName password
===== ======= =======
ABC Test Test
DEF Test2 Test2
UserPropertyInfo
------------------------
userId propertyName propertyValue
==== ========== ==========
ABC City XXXX
ABC Country YYYY
DEF null null
Now my query should be able to take the parameters from the user and
shoul retrive
the users with in the specified range.
The query is
select FIRST n SKIP m * from UserInfo u left outer join
userPropertyInfo up on u.userId=up.userId;
when the user invoke the API - getPropertie(1,2)
The query is retriving
ABC Test Test City XXXX
ABC Test Test Country YYYY
but my requirement is regardless of how many properties the user has,
all properties should be displayed as a single row. So for the above
API, it should retrieve
ABC Test Test City XXXX Country
YYYY (The join should be displed in a single row instead of diferent
rows)
DEF Test2 Test2 null null
is this possible in Firebird.....
Thanks n Regards,
==============
Rambabu
[Non-text portions of this message have been removed]