Results 1 to 2 of 2

Thread: Issue with namedQuery string parameters

  1. #1
    Join Date
    Jul 2009
    Posts
    5

    Question Issue with namedQuery string parameters

    I have the following named query:
    SELECT o FROM Organization o WHERE o.ooid = :ooid AND o.sor = :sor


    This will not return anything:

    Map<String, Object> namedParams = new HashMap<String, Object>();
    namedParams.put("ooid", ooid.trim());
    namedParams.put("sor", sor.trim());

    getJpaTemplate().findByNamedQueryAndNamedParams("" ,
    params);

    But this will:

    getJpaTemplate().find("SELECT new Organization(o.orgId, o.orgName) FROM Organization o where o.ooid='"+ooid+"' and o.sor='"+sor+"'");

    What exactly decides that it is a String parameter and put the quotes around the parameter?

  2. #2
    Join Date
    Jul 2009
    Posts
    5

    Post Named Queries

    Do you think this would have anything to do with the datasource configuration in websphere or with the Spring configuration of my entityManagerFactory or DAOs?

    Any idea where I should look first?

Posting Permissions

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