Semi New User Question.

From: Brad Messerle (bradleyfmesserl..ahoo.com)
Date: Wed Aug 27 2003 - 10:42:24 EDT

  • Next message: Andrus Adamchik: "Re: Why should I configure ServletConfiguration to listen for container events in the web.xml"

    Ok i have finally got the framwork up and running. I
    am just reusing example code.

    I can get the query to work, but the result set seems
    to return the wrong object.

    here is the code

    Configuration.bootstrapSharedConfiguration(this.getClass());
                    ctxt =
    Configuration.getSharedConfiguration().getDomain().createDataContext();

    String sql = "SELECT xxx.USERPROFILE.LOGINID AS
    LOGINID, xxx.USERPROFILE.PASSWORD AS PASSWORD,
    xxx.USERPROFILE.FIRSTNAME AS FIRSTNAME,
    xxx.USERPROFILE.LASTNAME AS LASTNAME FROM
    TPF.USERPROFILE WHERE xxx.USERPROFILE.LOGINID = '" +
    this.getCurrectUser().getUserid().trim()+"'";
                    
                             
    SqlSelectQuery query = new
    SqlSelectQuery(_Userprofile.class,sql);
    //SelectQuery query = new
    SelectQuery(_Userprofile.class, qual);
     // using log level of WARN to make sure that query
    // execution is logged to STDOUT
     query.setLoggingLevel(Level.WARN);
         
            List userprofiles = ctxt.performQuery(query);
            
                             if (userprofiles.size() == 1) {
                                    _Userprofile userprofile = (_Userprofile)
    userprofiles.get(0);
                                     System.out.println("\nFound User '" +
    userprofile.getFirstname() + "'.\n");
                                    // return gallery;
                             }
                             else if (userprofiles.size() == 0) {
                                     System.out.println("No matching galleries
    found.");
                             }
                             else {
                                     System.out.println("Found more than one matching
    gallery. Be more specific.");
                                     }
            }

    I hope u can make it out.

    But when i get the first element in the list object a
    hash table is returned so when i cast into my data
    object i get a cast exception.

    Any ideas?

    Thanks
    Brad Messerle

    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free, easy-to-use web site design software
    http://sitebuilder.yahoo.com



    This archive was generated by hypermail 2.0.0 : Wed Aug 27 2003 - 10:31:55 EDT