Questions tagged [secondary-table]

5 questions
2
votes
1 answer

Hibernate - Use formula on column from Secondary table

I have the following entity : @Entity @Table(name = "myTable") @SecondaryTable(name = "myOtherTable", pkJoinColumns = @PrimaryKeyJoinColumn(name = "someId")) @Data @AllArgsConstructor @NoArgsConstructor @Builder public class ContactEntity { @Id …
smillis12
  • 111
  • 5
1
vote
1 answer

JPA/Hibernate - mixed inheritance strategy using @SecondaryTable results in primary key violation

I am encountering a problem when trying to implement a mixed inheritance strategy using JPA. The same behaviour is observed (two inserts - one for each subclass level) when using Hibernate 5.2.18 (JPA 2.1), 5.3.5 (JPA 2.2), and 5.4.22 (JPA 2.2). I…
0
votes
0 answers

JPA secodaryTables with composite key

I'm working on a legacy database schema. On this schema there are 2 tables: clienti 1->many clienti_soc clienti has the primary key id_cliente, clienti_soc has composite key (id_cliente, id_societa). In my JPA application I need to pick the record…
Roberto Petrilli
  • 711
  • 1
  • 8
  • 22
0
votes
1 answer

JPA Secondary table causes error cause of Foreign Key restriction

So I have two tables: Create Table annotation_table (Id varchar(255), Hash varchar(255), PRIMARY KEY (Id, Hash)); Create Table commit_table (Id varchar(255), Hash varchar(255), commit_Id varchar(255), PRIMARY KEY (Id, Hash), FOREIGN KEY (Id, Hash)…
0
votes
1 answer

Mapping Single Entity to Multiple Tables in JPA: Error

I'm developing a Java Spring Boot Web App and am having an issue with mapping an entity to multiple tables. The two tables at hand are "Profile" and "Users". Users has the attribute "email", which I would like to be able to put into Profile. To do…