Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 02:32 AM
Member
 
Join Date: Apr 2008
Posts: 3
hossainsadd is on a distinguished road
pls somebody help me ; need to understand SQL queries from DAOImpl class
Hi I just have joined a company as a Junior software engineer. I was asked to analyze an App named CRM Admin Console and find out the tables and their relation. This admin console authenticates user. Now I need to build a web application named Promo Admin Console which will be similar to CRM Admin Console and most probably will use the same table. This Promo Admin Console will authenticate a user to create a promo, see the existing promo or delete the existing promo. Some users may see the promo but cannot Edit or create it and some users will be able to do all.

Now I have to find out the tables and relationships from the CRM Admin Console and then give my design of what tables to use, what domain objects , what controllers and interfaces I want to use for the Promo Admin Console given that they use Spring MVC..

Now I am stuck as I am not good at understanding database at all. I have looked at the UserDAOImpl of the CRM Admin Console and they have the following 2 methods and queries . I understood little bit what they are doing with the methods but what are they doing with the queries, no clue. the methods and queries are:

Method#1:

public User findUser(final String id) {
User user = null;
if (logger.isDebugEnabled()) logger.debug("UserDAo Impl Start");
user =(User) queryForObject(userSql,
new Object[] {id.toUpperCase()},
new RowMapper () {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
User user = new User(String.valueOf(rs.getInt("objid")));
user.setLogin(rs.getString("login_name"));
user.setPassword(rs.getString("password"));
return user;
}
});

return user;
}


Method # 2:

public List findUsersByGroup(String groupName) {
List userList=this.getJdbcTemplate().query(userbygroup, new Object[]{groupName},
new RowMapper() {
public Object mapRow(ResultSet rs, int arg1) throws SQLException {
User user = new User(String.valueOf(rs.getInt("objid")));
user.setLogin(rs.getString("login_name"));
user.setPassword(rs.getString("password"));
return user;
}
}
);

return userList;
}

Query#1

private final String userSql =
" select " +
"table_user.objid , " +
"table_user.login_name , " +
"table_user.password " +
"from " +
"table_user " +
"where " +
"table_user.s_login_name = ? " ;

Query#2

private final String userbygroup =
"select " +
"unique " +
"table_user.objid , " +
"table_user.password , " +
"table_user.login_name " +
"from " +
"table_user , " +
"table_x_sec_grp , " +
"table_x_sec_func , " +
"mtm_user125_x_sec_grp1 , " +
"mtm_x_sec_grp2_x_sec_func0 " +
"where " +
"table_x_sec_grp.x_grp_name = ? " +
"and mtm_user125_x_sec_grp1.user2x_sec_grp = table_user.objid " +
"and mtm_user125_x_sec_grp1.x_sec_grp2user = table_x_sec_grp.objid " +
"and mtm_x_sec_grp2_x_sec_func0.x_sec_func2x_sec_grp = table_x_sec_func.objid " +
"and mtm_x_sec_grp2_x_sec_func0.x_sec_grp2x_sec_func = table_x_sec_grp.objid " +
"order by table_user.login_name ";


Here is the response from one of the employee after I emailed her:

" We are using existing tables for the user roles and authorization for admin console I don't remember exactly the table names . Mark has relation ship table diagram for user roles and authorization relations.

table_user
table_x_sec_grp
mtm_user125_x_sec_grp1
table_x_sec_function
mtm_x_sec_grp2_x_sec_func0

above are the tables where we store User roles and Functions and Groups which they belong "


Now the answers and suggestions I need.

1. what are they doing with the queries in UserDAOImpl

2. how could I analyze the tables and their relationships??? Somebody asked me to use Toad or something. But how and to do what?

3. how could I relate these tables of the CRM Admin Console with the Promo Admin Console which I need to design and later code it?

4. I dont understand how could CRM Admin Console and Promo Admin Console might have same tables??

I am not sure whether I will get any response or not caz I guess I am asking too much.. But still trying as I am totally blank at this moment and asking other employees within the company is really hard as everybody is so busy with their own tasks, feeling shy to ask them so many questions.. This is the first time I am trying online help and I dont know how it works. If somebody could give me a direction to understand these problems would be helpful , well not only helpful but also life saver . If this is not a right place please please instruct me how and where to go for help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help me need to understand queries hossainsadd Database 0 04-15-2008 02:30 AM
How to run Queries in Spring framework Java Tip Java Tips 0 04-01-2008 11:42 AM
queries regarding SWT ravian New To Java 0 11-26-2007 04:06 PM
some queries Feng New To Java 7 11-24-2007 09:10 PM
How to run Queries in Spring framework JavaBean Java Tips 0 09-28-2007 02:00 PM


All times are GMT +3. The time now is 06:29 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org