-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first attempt at automatic deletion taking into account contained ref…
…erences. * necessary to delete the referrers first, as JPA ordering is not guaranteed * does not deal with the case that the referrer is at different level.
- Loading branch information
Showing
17 changed files
with
117 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,11 @@ | |
* Created on 29/03/2022 by Paul Harrison ([email protected]). | ||
*/ | ||
|
||
import jakarta.persistence.EntityManager; | ||
|
||
/** | ||
* Interface to implement some common manipulations in JPA. | ||
* This interface will be implemented on ObjectTypes. | ||
*/ | ||
public interface JPAManipulationsForObjectType <ID> extends JPAManipulations { | ||
|
||
|
@@ -13,7 +16,13 @@ public interface JPAManipulationsForObjectType <ID> extends JPAManipulations { | |
* @return the database ID. | ||
*/ | ||
ID getId(); | ||
|
||
|
||
|
||
/** | ||
* Delete the entity from the database. This will take into account any ordering necessary because of any contained references. | ||
* If there are no contained references - then this will be equivalent to em.delete(this), however there might be some efficiency built in via bulk deletion. | ||
* @param em the entity manager | ||
*/ | ||
void delete(EntityManager em); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
import static org.junit.jupiter.api.Assertions.fail; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import jakarta.persistence.EntityManager; | ||
|
||
/* | ||
* Created on 16/05/2023 by Paul Harrison ([email protected]). | ||
*/ | ||
|
@@ -31,6 +33,13 @@ public BaseC copyMe() { | |
"Type1728055728713.copyMe() not implemented"); | ||
|
||
} | ||
|
||
@Override | ||
public void delete(EntityManager em) { | ||
// TODO Auto-generated method stub | ||
throw new UnsupportedOperationException("JPAManipulationsForObjectType<Long>.delete() not implemented"); | ||
|
||
} | ||
}, "eval"); | ||
fail("should have thown exception for value outside vocab"); | ||
} catch (Exception e) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters