hey everyone i have a spring boot rest api that have duplicated result for every key and value like the code below
this my object
{
id: 2,
Nom: "ee",
Prenom: "az",
Profil: "RC",
Pseudo: "aze",
Password: null,
role: null,
password: null,
nom: "ee",
prenom: "az",
profil: "RC",
pseudo: "aze"
},
{
id: 3,
Nom: "xx",
Prenom: "xxx",
Profil: "dataa",
Pseudo: "data",
Password: null,
role: null,
password: null,
nom: "xx",
prenom: "xxx",
profil: "dataa",
pseudo: "data"
},
{
as you can see every column is duplicated one with uppercase First letter other all in lowercase
this is my class :
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="\"UTILISATEUR\"")
public class Utilisateur {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="\"IdUtilisateur\"")
public Long id ;
@Column(name="\"Nom\"")
public String Nom ;
@Column(name="\"Prenom\"")
public String Prenom ;
@Column(name="\"Profil\"")
public String Profil ;
@Column(name="\"Pseudo\"")
public String Pseudo ;
@Column(name="\"Password\"")
public String Password ;
@ManyToOne
@JoinColumn(name="\"id_role\"")
public Role role ;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNom() {
return Nom;
}
public void setNom(String nom) {
Nom = nom;
}
public String getPrenom() {
return Prenom;
}
public void setPrenom(String prenom) {
Prenom = prenom;
}
public String getProfil() {
return Profil;
}
public void setProfil(String profil) {
Profil = profil;
}
public String getPseudo() {
return Pseudo;
}
public void setPseudo(String pseudo) {
Pseudo = pseudo;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public Utilisateur(String nom, String prenom, String profil, String pseudo, String password,
Role role) {
super();
Nom = nom;
Prenom = prenom;
Profil = profil;
Pseudo = pseudo;
Password = password;
this.role = role;
}
public Utilisateur() {
super();
}
am using postgres from my database and this is my code
CREATE TABLE "UTILISATEUR"
(
"IdUtilisateur" serial NOT NULL,
"Nom" character varying(50),
"Prenom" character varying(50),
"Profil" character varying(50),
"Pseudo" character varying(20),
"IdSite" integer DEFAULT 0,
"Password" character varying(1024),
id_role integer,
)
and finaly this is my application.propreties
spring.datasource.url = jdbc:postgresql://localhost/baseecu
spring.datasource.username = postgres
spring.datasource.password =root
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.database = MYSQL
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto= update
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
i thought maybe it's a jdbc issue because am using postgres 9.2 and jdbc is for 9.1 i had an issue with the dialect before JPA Uppercase table names after that issue i tried to make it work and now i got this
any help or guide will be appreciated