I have a very simple Spring Boot application deployed on Heroku. The application itself works fine in terms of the Controller - the API returns some simple JSON, nothing too special.
I've added a Postgres database to Heroku and on application startup I see that Spring creates the table as expected. It is only 1 table with a super simple mapping class:
@Entity
public class Score implements Serializable {
private static final long serialVersionUID = -2899157432342241888L;
private String customer;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private Date date = new Date();
private int score;
//setters and getters
The repository is just an interface with no explicit implementation:
@Repository
public interface ScoreRepository extends CrudRepository<Score, Long>
I call repository.save(...) in a @Service annotated class that has the repository auto-wired in. I assume that is working ok, because I'm not seeing any errors - yet I don't see any records being persisted to the database! No idea what could be going wrong here; I suppose I could have set up Heroku wrong, or maybe there's something obvious that I missed with the Postgres setup in Heroku?
Secondary question
Maybe related, but logging doesn't seem to work too well either. According to Heroku documentation I can print to standard out and it should appear in the log, but this doesn't happen. Moreover I have this in properties file:
spring.jpa.show-sql=true
But I see no such logging of SQL queries in the heroku logs.
Any help much appreciated! Thanks in advance.