Results 1 to 2 of 2

Thread: hql query

  1. #1
    Join Date
    Jun 2010
    Rep Power

    Default hql query

    String hqlQuery="from PreferentialTariffDTO pref where pref.hsCodeList.prefId=pref.prefId and pref.cpcCode='"+cpcCode+"' and pref.hsCodeList.hsCode='"+hsCode+"'";

    List<PreferentialTariffDTO> listpref=getListWithHQL(hqlQuery);

    is above hql query is right or wrong?

    there PreferentialTariffDTO is the parent table pojo class.

    and hsCodeList is the child table PrefHSDetailDTO.

    now i need to pick the records which satisfy the above conditions.
    Muralikrishna K

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    Well, what Exception are you getting? The full stack trace. And don't cobble together statements like that unless you want sporadic SQL syntax errors or want to allow SQL Injection attacks. Use PreparedStatement (properly).

    Edit: P.S. if you question concerns syntax alone, find an SQL forum.

Similar Threads

  1. Sql Query
    By Nomad in forum JDBC
    Replies: 16
    Last Post: 02-20-2009, 02:58 PM
  2. I need help with a query.
    By Daredemo in forum JDBC
    Replies: 1
    Last Post: 08-13-2008, 06:16 AM
  3. Help in Query
    By geeta_ravikanti in forum JDBC
    Replies: 0
    Last Post: 03-31-2008, 02:16 PM
  4. Using sql:query tag
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-15-2008, 04:13 PM
  5. Using sql:query tag
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-14-2008, 10:31 AM

Tags for this Thread

Posting Permissions

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