generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PI-2673 - move test data creation back to data loader
- Loading branch information
1 parent
6276745
commit cacb78f
Showing
3 changed files
with
27 additions
and
10 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
23 changes: 23 additions & 0 deletions
23
...or-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/EntityManagerDataLoader.kt
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package uk.gov.justice.digital.hmpps.data | ||
|
||
import jakarta.persistence.EntityManager | ||
import jakarta.persistence.PersistenceContext | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
import uk.gov.justice.digital.hmpps.data.generator.NsiGenerator | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referral.entity.Nsi | ||
|
||
@Component | ||
class EntityManagerDataLoader { | ||
|
||
@PersistenceContext | ||
private lateinit var entityManager: EntityManager | ||
|
||
var NSI_FUZZY_SEARCH : Nsi? = null | ||
|
||
@Transactional | ||
fun loadData() { | ||
NSI_FUZZY_SEARCH = entityManager.merge(NsiGenerator.FUZZY_SEARCH) | ||
entityManager.merge(NsiGenerator.TERMINATED) | ||
} | ||
} |
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