I am relearning Hibernate and JPA. I am using Spring Boot, Gradle and Postgres for my environment. I have a set of domain objects that access a Postgres database. Two objects do not use annotation and use a JDBCTemplate class for database operation. The other set of domain objects use JPA annotations. The JPA set of objects have relationships mapped out using the JPA annotations. When I run my unit tests for checking the database entities for the JDBC Template objects, all is fine. When I check the database, I discovered I have duplicate entities for those domain objects using annotation.
I have reviewed my annotations and setup of the project and have been unsuccessful in locating the my error.
Here is my class definition:
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
@Entity(name="AcceptanceCriteria")
@Table(name="accCriteria_tbl", schema="ia_req_changes")
@SequenceGenerator(name="AcceptCritera_SEQ_GEN", schema="ia_req_changes", sequenceName = "accCriteria_tbl_accCri_id_seq", initialValue = 1, allocationSize = 1)
public class AcceptanceCriteria implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="AcceptCritera_SEQ_GEN")
@Column(name="accCri_id", updatable = false)
private Long accCri_id;
@Column(name="accAction")
private String accAction;
@Column(name="accControl")
private String accControl;
@Column(name="accAccptCriteria")
private String accAccptCriteria;
@Column(name="lastModified")
private Timestamp lastModified;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FK_funcReq_id", referencedColumnName = "funcReq_id")
private FunctionalRequirement functionalReq;
public AcceptanceCriteria() {
}
Here is a look at the table from Postgres. The noticeable difference is the table I created with the DDL is the one with the uppercase table name.
Any suggestions or recommendations would be greatly appreciated.
Thanks,
Russ