Results 1 to 2 of 2
  1. #1
    hossainsadd is offline Member
    Join Date
    Apr 2008
    Posts
    3
    Rep Power
    0

    Default help me need to understand queries

    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.

  2. #2
    derrickD is offline Member
    Join Date
    Apr 2007
    Location
    USA
    Posts
    50
    Rep Power
    0

    Default

    1. They are querying for the user based on the id sent in. They are mapping the result to a map, it appears. Check out Spring as it looks like that is what they are using.
    2. Download toad and log into the database and check the constraints. I think toad also may make a relationship diagram, I know dbvisualizer will, both are free.
    Can't answer the other two.
    Good luck on your new job.

Similar Threads

  1. Replies: 0
    Last Post: 04-15-2008, 02:32 AM
  2. How to run Queries in Spring framework
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 04-01-2008, 11:42 AM
  3. queries regarding SWT
    By ravian in forum New To Java
    Replies: 0
    Last Post: 11-26-2007, 04:06 PM
  4. some queries
    By Feng in forum New To Java
    Replies: 7
    Last Post: 11-24-2007, 09:10 PM
  5. How to run Queries in Spring framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-28-2007, 02:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •