I am using PlanetScale (Database) which doesn't allow foreign keys, so I am trying to enforce referential integrity in the application instead of the database. Is there an easy and efficient way of checking for child records before deleting the Entity?
My first thought was to use use the @PreRemove annotation and check a @JoinColumn (List) if it is empty. Will this be slow and inefficient? I expect there to be many children.
Is it possible to limit the @JoinColumn only to fetch the first record since I only need to know if there are one or more records?