Results 1 to 2 of 2

Thread: missing quotes in generated SQL around string literal, help!

  1. #1
    Join Date
    May 2005
    Posts
    1

    Default missing quotes in generated SQL around string literal, help!

    Hi I am a beginner of spring/hibernate (3.0) and postgres (8.0.3), and I ran into a strange problem.
    I am just trying to insert to a table (called "groups", which has id (int), name and description which are both char). id is auto-generated sequence.

    so from the jsp page, I input "aname" and "adesc" as their values,
    but from the log, it shows this statement is generated by hibernate:

    insert into groups (name, description, id) values (aname, adesc, 1)

    And that causes GrammarException because aname and adesc is not quoted.

    I ran the same in postgres manually and it won't run. The correct sql should be:

    insert into groups (name, description, id) values ("aname","adesc", 1)

    Then it runs successfully.

    Why does the hibernate not surround string literal with quotes? is it a configuration somewhere I can set? I can't pass this point, please help me...

    thanks. -lwen

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Lwen,

    This is more of a Hibernate related post. You should probably check out their forums as I am sure they have answered this one before

    Regards,

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

Similar Threads

  1. Replies: 17
    Last Post: Jan 2nd, 2007, 01:43 PM
  2. Replies: 8
    Last Post: Jul 13th, 2005, 11:20 AM
  3. Spring + Hibernate ORA-00936: missing expression
    By Hugh_la_Main in forum Data
    Replies: 1
    Last Post: Jun 28th, 2005, 08:48 AM
  4. Transaction Management
    By caverns in forum Data
    Replies: 3
    Last Post: Mar 8th, 2005, 06:38 AM
  5. Enlisting Custom DataSource with JTa
    By shaby775 in forum Data
    Replies: 11
    Last Post: Sep 9th, 2004, 03:00 AM

Posting Permissions

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