Skip to content

Tag: spring-data-jpa

Who should be parent in spring JPA relationship

I have 3 tables book, publisher, author. Here author and publisher can refer to same record in book therefore I decided to make book as relationship parent. However I also want to make it so that if a publisherA is deleted, all the book record related to publisherA also get deleted. same goes for author. I tr…

Understanding JPA sequence generator

I’m using spring data JPA’s sequence generator to assign primary keys to entities. Model contains: The corresponding sequence definition(for SQL Server DB): Since I wanted to start the ids from 100 instead of 1, so I updated the sql script to And then I encountered the problem as mentioned here. I…