i am developing an application using spring boot and postgreSql. I am getting the following error while executing select query using where clause

I am doing this in my repository.I am trying to fetch the user details using his email id by using native query:

@Repository
@Transactional
public class RegistrationRepository {
        @Autowired
    EntityManager em;

     private Logger logger=LoggerFactory.getLogger(this.getClass());

     public UserDetailsEntity getUserDetails(String emailId) {
        Query query=em.createNativeQuery("select * from 
      UserDetailsEntity where userEmail=:userEmail",UserDetailsEntity.class);
        query.setParameter("userEmail", emailId);
        List result=query.getResultList();
        logger.info("result======>{}",result);
        return null;
    }
}

Entity class is given below:


package com.counselor.entities;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

@Entity
public class UserDetailsEntity {

    @Id
    @GeneratedValue
    private Long userId;

    private String userEmail;

    private String password;

    private String phoneNumber;

    @UpdateTimestamp
    private LocalDateTime lastUpdatedDate;

    @CreationTimestamp
    private LocalDateTime createdDate;

    @OneToMany(mappedBy="mappingUserDetailsEntity")
    private List<RegistrationDetails> listofSubmittedProposals=new ArrayList<>();

    //getters and setters   
}

I am getting this error on console


org.postgresql.util.PSQLException: ERROR: relation "userdetailsentity" does not exist
  Position: 15

0 Answers