PostgreSQL and Hibernate ‘Upper case’ problem

Author:

Today,  i find out strange buggy problem on postgresql and hibernate integration implementation …

as an illustration, i have a table, named user with the following column

USER {

ID,

USERNAME,

PASSWORD

}

Then i create model according to current table as follow :

@Entity

@Table(name = “user”)

public class User implements Serializable {

private Integer id;

private String username;

private String password;

public User(){

}

public User(int id){

this.id = id;

}

@Id

@GeneratedValue(strategy = IDENTITY)

@Column(name = “ID”, unique = true, nullable = false)

public Integer getId() {

return id;

}

..

..

..

But, the strange problem appear when the query invoked, the following problem arises .

error
error

“column this_.ID doesn’t exist “

after several time debugging and try new different configuration, the solution is just convert all column name in user table and table name into lowercase.

and my table now is like this :

user{

id,

username,

password

}

and also the model change to lower case in annotation mapping declaration ..

@Id

@GeneratedValue(strategy = IDENTITY)

@Column(name = “id”, unique = true, nullable = false)

 

Jakarta, 5 September 2012

JWeBs Tower

 

A. Ahmad Kusumah

 

Leave a Reply

Your email address will not be published. Required fields are marked *