users@glassfish.java.net

Re: SQLSyntaxException

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 Aug 2008 16:49:40 PDT

What version of NetBeans are you using? The tutorial is for NetBeans 6.1. It seems that you're using 6.5. Since the generated entity class has changed a little bit in NetBeans 6.5, the manually fixing part of the tutorial is not totally actually anymore. For example, in Order.java,
6.1:

    @Column(name = "PRODUCT_ID", nullable = false)
    private int productId;

6.5:
       @Basic(optional = false)
       @Column(name = "PRODUCT_ID")
         private int productId;

So, the following instruction in the tutorial leaves an extra @Basic

   1. In the Orders class, replace this field declaration and annotation

          @Column(name = "PRODUCT_ID", nullable = false)
          private int productId;
                

      with this code:

          @JoinColumn(name = "PRODUCT_ID", referencedColumnName = "PRODUCT_ID")
          @ManyToOne
          private Products productId;
[Message sent by forum member 'dcao' (dcao)]

http://forums.java.net/jive/thread.jspa?messageID=294930