Hi
I have a collection of People that contains a collection of Accounts, that contains a collection of fundsm that i insert into a table .
I have mapped this as People manyToMany Accounts manyTomany Funds in my JPA layer
I have free tables PEOPLE, ACCOUNT, FUND
I am extending org.springframework.data.jpa.repository.JpaRepository and use JpaRepository List save(Iterable entities);
This code works, and I can add and read from the DB.
But now I want to extend the functionality, in FUND i have added a datetime, and if the fund comes in and has a datetime that is less than the datetime in the Table. I dont want that data inserted.
Now I know of two ways to add this logic
1) I can add this check in the
Java layer, which I dont want to do, as it means hitting the FUND Table to get dateTimes, then again to insert from the java code.
2) Use Hibernate Query Language to write the JPA layer
But I want to keep with usng the JpaRepository methods. Is there an annotation that i can use on the Entity, that says check a condition is satisfied before saving the data.
Thanks for any help
Tony