org.hibernate.exception.SQLGrammarException:无法执行语句,

时间:2013-07-01 05:07:47

标签: mysql hibernate

public void fontProperties(){

 Fonts fl=new Fonts();

Session sess = HibernateUtil.getSessionFactory()。openSession();

    Transaction tx1=sess.beginTransaction();        

    fl.setFont("arial");
    fl.setSize("arial1");
    fl.setStyle("arial2");
    fl.setLineheight("arial3");
    fl.setColor("arial4");
    fl.setBgcolor("arial5");
    fl.setBgimage("arial6");
    fl.setWidth("arial7");
    fl.setHeight("arial8");
    fl.setTop("arial9");
    fl.setRight("arial10");
    fl.setBottom("arial11");
    fl.setLeft("arial12");

    sess.save(fl);
         tx1.commit();
    sess.close();

例外:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'right, bottom, left, sid) values ('arial', 'arial1', 'arial2', 'arial3', 'arial4' at line 1

1 个答案:

答案 0 :(得分:1)

rightleftreserved MySQL keywords。更改这些列的名称。