Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:53:25+00:00 2026-06-05T18:53:25+00:00

I get an error com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column ‘productId3’ in ‘where clause’ when trying to

  • 0

I get an error com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'productId3' in 'where clause' when trying to run this query:

public Vendor getVendorId(ProductInfo productInfo) { 
        return (Vendor) this.sessionFactory
                .getCurrentSession()
                .createQuery(
                        "select vendorId from Product where productId3 = :id")
                .setParameter("id", productInfo).uniqueResult();
    }

The class Product looks like this:

@Entity
@Table(name="PRODUCT")
public class Product{

    @Id
    @GeneratedValue
    @Column(name="PRODUCT_ID2")
    private Integer productId2;

    public void setProductId2(Integer productId2){
        this.productId2 = productId2;
    }

    public Integer getProductId2(){
        return productId2;
    }

    @ManyToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="PRODUCT_ID3")
    private ProductInfo productId3;

    public void setProductId3(ProductInfo productId3){
        this.productId3 = productId3;
    }

    public ProductInfo getProductId3(){
        return productId3;
    }

    @ManyToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="VENDOR_ID")
    private Vendor vendorId;

    public void setVendorId(Vendor vendorId){
        this.vendorId = vendorId;
    }

    public Vendor getVendorId(){
        return vendorId;
    }

    @OneToMany(mappedBy="productId2")
    private Set<ProductRevision> productRevisions;

    public void setProductRevisions(Set<ProductRevision> productRevisions){
        this.productRevisions = productRevisions;
    }

    public Set<ProductRevision> getProductRevisions(){
        return productRevisions;
    }
}

Why do I get this error? I don’t understand why it can’t find the column as the name is exactly the same. Thanks for your help!

/D

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:53:26+00:00Added an answer on June 5, 2026 at 6:53 pm

    Use this query:

    select p.vendorId from Product p where p.productId3 = :id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've set the classpath envoirenment but still get an error Exception:com.mysql.jdbc.Driver Do you have
I'm getting this error while running tomcat 'java.lang.ClassNotFoundException: com.mysql.jdbc.Driver'. I'm using a combination of
I am Working around MySQL error Deadlock found when trying to get lock; try
When trying to connect to mysql I always get this error: java.sql.SQLException: No suitable
I'm trying to insert some data into mysql database, but I get an error
Glassfish is not loading the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource package. The following error is thrown javax.persistence.PersistenceException: Exception
I get this error message when i use URL Linter with my website http://developers.facebook.com/tools/debug/og/object?q=iulianonofrei.com
I use sendSynchronousRequest:returningResponse:error method of NSURLConnection class to get NSData from network. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html NSData
When going to http://foo.com/bar.php?url=http://foobar.com/ I get a 403 Forbidden error. The same happens if
When I try to start MySQL I get: ERROR 2002 (HY000): Can't connect to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.