org.postgresql.util.PSQLException: ERROR: column "feedbackid" does not exist Position: 8
I am getting this error but unable to understand what the reason behind this. It shows:- **
org.postgresql.util.PSQLException: ERROR: column "feedbackid" does not exist Hint: Perhaps you meant to reference the column "feedback.feedbackId". Position: 8
**
Database table in postgres:
create table `company`.`feedback` (
feedbackId
int(10) NOT NULL, feedbackActionId
int(12) NOT NULL, description
varchar(200) DEFAULT NULL, feedbackText
varchar(2000) DEFAULT NULL, email
varchar(100) NOT NULL, createdDate
date NOT NULL );
public Feedback getFeedbackById(int id) throws SQLException, ClassNotFoundException {
conn = DBConnection.setDBConnection();
String sqlQuery = "select feedbackId, feedbackActionId, description, feedbackText, email, createdDate" +
"from feedback " +
" where feedbackId = " + id ;
DBConnection dbConn = new DBConnection();
ResultSet resultSet = dbConn.getResultSet(sqlQuery, conn);
int feedbackId = resultSet.getInt("feedbackId");
int feedbackActionId = resultSet.getInt("feedbackActionId");
String description = resultSet.getString("description");
String feedbackText = resultSet.getString("feedbackText");
String email = resultSet.getString("email");
Date createdDate = resultSet.getDate("createdDate");
feedback = new Feedback(feedbackId, feedbackActionId, description, feedbackText, email, createdDate);
resultSet.close();
return feedback;
}
Thanks in advance.
This question might help you. Looks like Postgres is case senstive towards column names. You might need to include field name in quotes. Are PostgreSQL column names case-sensitive?
Please Try to use: @GeneratedValue(strategy = GenerationType.IDENTITY) in your POJO class Id Field. This thing solved my error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.