Announcement Announcement Module
Collapse
No announcement yet.
missing quotes in generated SQL around string literal, help! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X