In my data model, I have something to this effect:
#Entity
public class Target {
#Id
#GeneratedValue
private Long id;
/* ...etc... */
}
#Entity
public class Dependency {
#Id
#GeneratedValue
private Long id;
#ManyToOne(optional=false)
#Column(name="target_id")
private Target target;
/* ...etc... */
}
I'm already serializing Target just fine, but I need to serialize Dependency. Essentially, what I need is something like this:
<dependency>
<id>100</id>
<targetId>200</targetId>
</dependency>
Is there a way to do this in JAXB annotations without modifying my model?
You could use an XmlAdapter for this use case:
package forum7278406;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class TargetAdapter extends XmlAdapter<Long, Target> {
#Override
public Long marshal(Target target) throws Exception {
return target.getId();
}
#Override
public Target unmarshal(Long id) throws Exception {
Target target = new Target();
target.setId(id);
return target;
}
}
The XmlAdapter is registered on the Dependency class using the #XmlJavaTypeAdapter annotation:
package forum7278406;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
#Entity
#XmlRootElement
#XmlAccessorType(XmlAccessType.FIELD)
public class Dependency {
#Id
#GeneratedValue
private Long id;
#ManyToOne(optional=false)
#Column(name="target_id")
#XmlJavaTypeAdapter(TargetAdapter.class)
private Target target;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Target getTarget() {
return target;
}
public void setTarget(Target target) {
this.target = target;
}
}
Going Further
Instead of just creating a new instance of Target we could use an EntityManager to query the corresponding instance from the database. Our XmlAdapter would be changed to look something like:
package forum7278406;
import javax.persistence.EntityManager;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class TargetAdapter extends XmlAdapter<Long, Target> {
EntityManager entityManager;
public TargetAdapter() {
}
public TargetAdapter(EntityManager entityManager) {
this.entityManager = entityManager;
}
#Override
public Long marshal(Target target) throws Exception {
return target.getId();
}
#Override
public Target unmarshal(Long id) throws Exception {
Target target = null;
if(null != entityManager) {
target = entityManager.find(Target.class, id);
}
if(null == target) {
target = new Target();
target.setId(id);
}
return target;
}
}
Now to set the instance of EntityManager on our XmlAdapter, we can do the following:
Unmarshaller umarshaller = jaxbContext.createUnmarshaller();
TargetAdapter targetAdatper = new TargetAdapter(entityManager);
unmarshaller.setAdapter(targetAdapter);
It works for EclipseLink MOXy with XmlID and XmlIDRef (but fails for sun JAXB, where XmlID must be string)
#Entity
#XmlRootElement
public class Target {
#Id
#GeneratedValue
#XmlID
#XmlElement
private Long id;
}
#Entity
#XmlRootElement
public class Dependency {
#Id
#GeneratedValue
#XmlElement
private Long id;
#ManyToOne(optional = false)
#Column(name = "target_id")
#XmlIDREF
#XmlElement(name = "targetId")
private Target target;
}
Related
my problem is that when I'm trying to use #RepositoryEventHandeler annotation I get "Cannot resolve symbol 'RepositoryEventHandler'" information, as if Spring didn't recognize this annotation, I checked and it does not look like I need to add any dependencies for it to work. It's my first attempt at using it so maybe I got the whole idea behind it wrong. What am I doing wrong? Thanks in advance.
Configuration class where I create a bean from class annotated with #RepositoryEventHandler
#Configuration
public class ConfigurationBeans {
#Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
#Bean
public AbsenceRepositoryEventHandler absenceRepositoryEventHandler() {
return new AbsenceRepositoryEventHandler();
}
}
Repository
#Repository
public interface AbsenceRepository extends JpaRepository<Absence, Long> {
List<Absence> findAbsencesByBarberId(Long barberId);
List<Absence> findAbsencesByWorkDay_Id(Long workDayId);
}
Entity
#Getter
#Entity
#Table(name = "absences")
#Builder
#AllArgsConstructor
#NoArgsConstructor
public class Absence {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id", nullable = false)
private Long id;
#ManyToOne
#NotNull
#JoinColumn(name = "barber_id")
private Barber barber;
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "work_day_id")
private WorkDay workDay;
#NotNull
#Column(name = "absence_start")
private LocalTime absenceStart;
#NotNull
#Column(name = "absence_end")
private LocalTime absenceEnd;
}
Class annotated with #RepositoryEventHandler (this annotation is all red and gives Cannot resolve symbol 'RepositoryEventHandle info)
#RepositoryEventHandler(Absence.class)
public class AbsenceRepositoryEventHandler {
#HandleBeforeCreate
public void handleAbsenceBeforeCreate(Absence absence){
}
}
Controller class
#RestController
#AllArgsConstructor
#CrossOrigin(origins = "http://localhost:3000")
public class AbsenceController {
private final AbsenceServiceImpl absenceService;
private final AbsenceRepository absenceRepository;
#GetMapping("/absences")
public List<Absence> getAllAbsences() {
return absenceRepository.findAll();
}
#GetMapping("/absencesById")
public AbsenceDto getAbsencesById(#RequestParam Long id) {
return absenceService.getAbsenceById(id);
}
#GetMapping("/absencesByBarber")
public List<AbsenceDto> getAbsencesByBarber(#RequestParam Long id) {
return absenceService.getAbsenceByBarber(id);
}
#GetMapping("/absencesByWorkDay")
public List<AbsenceDto> getAbsencesByWorkDay(#RequestParam Long id) {
return absenceService.getAbsenceByWorkDay(id);
}
#PostMapping("/absence")
public AbsenceDto createAbsence(#RequestBody #Valid CreateAbsenceDto absenceDto) {
return absenceService.addAbsence(absenceDto);
}
#PutMapping("/update/absence/{id}")
public ResponseEntity<String> updateAbsence(#PathVariable("id") long id, #RequestBody #Valid AbsenceDto absence) {
absenceService.updateAbsence(id, absence);
return new ResponseEntity<>("Absence was updated.", HttpStatus.OK);
}
#DeleteMapping("/delete/absence/{id}")
public ResponseEntity<String> deleteAbsence(#PathVariable("id") long id) {
absenceService.removeAbsence(id);
return new ResponseEntity<>("Absence was deleted.", HttpStatus.OK);
}
}
Got it. Should've added dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
<version>3.0.1</version>
</dependency>
Now it works.
I have an ExampleRequest entity that can optionally have one or more ExampleRequestYear. It's currently configured this way (unrelated fields and gettters/setters omitted for brevity, please let me know if you need anything else):
#Entity
#Table(name = "EXAMPLE_REQUEST")
#SequenceGenerator(name = "EXAMPLE_REQUEST_ID_SEQ", sequenceName = "EXAMPLE_REQUEST_ID_SEQ", allocationSize = 1)
#Cacheable(false)
public class ExampleRequest implements Serializable {
#Id
#GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EXAMPLE_REQUEST_ID_SEQ")
#Column(name="EXAMPLE_REQUEST_ID", nullable = false)
private Long exampleRequestId;
#OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "exampleRequest")
private List<ExampleRequestYear> exampleRequestYearList;
public ExampleRequest() {
}
public List<ExampleRequestYear> getExampleRequestYearList() {
if(this.exampleRequestYearList == null){
this.exampleRequestYearList = new ArrayList<ExampleRequestYear>();
}
return this.exampleRequestYearList;
}
public void setExampleRequestYearList(List<ExampleRequestYear> exampleRequestYearList) {
this.exampleRequestYearList = exampleRequestYearList;
}
public ExampleRequestYear addExampleRequestYear(ExampleRequestYear exampleRequestYear) {
getExampleRequestYearList().add(exampleRequestYear);
exampleRequestYear.setExampleRequest(this);
return exampleRequestYear;
}
public ExampleRequestYear removeExampleRequestYear(ExampleRequestYear exampleRequestYear) {
getExampleRequestYearList().remove(exampleRequestYear);
exampleRequestYear.setExampleRequest(null);
return exampleRequestYear;
}
}
#Entity
#Table(name = "EXAMPLE_REQUEST_YEAR")
#IdClass(ExampleRequestYearPK.class)
public class ExampleRequestYear implements Serializable {
#Id
#Column(nullable = false)
private Integer year;
#Id
#ManyToOne
#JoinColumn(name = "EXAMPLE_REQUEST_ID", referencedColumnName = "EXAMPLE_REQUEST_ID")
private ExampleRequest exampleRequest;
public ExampleRequestYear() {
}
public void setExampleRequest(ExampleRequest exampleRequest) {
this.exampleRequest = exampleRequest;
}
public ExampleRequest getExampleRequest() {
return exampleRequest;
}
}
Part of the code was auto-generated by the IDE and I'm still wrapping my head around JPA so there're probably design mistakes all around.
My app works (apparently) when I create a new ExampleRequest:
ExampleRequest exampleRequest = new ExampleRequest();
ExampleRequestYear exampleRequestYear = new ExampleRequestYear(2020);
request.addExampleRequestYear(exampleRequestYear);
However, I can't figure out how to edit an existing ExampleRequest because I'm unsure on how I'm meant to retrieve the linked entities. According to articles I've read, lazy fetching should be automatic, yet when I try this:
ExampleRequest exampleRequest = employeeRequestsController.getExampleRequestById(123);
System.out.println(exampleRequest.getExampleRequestYearList().size());
... I get a null pointer exception upon .size() because the getter runs but neither initialises an empty list, nor retrieves items from DB:
public List<ExampleRequestYear> getExampleRequestYearList() {
if(this.exampleRequestYearList == null){
// Field is null and conditional is entered
this.exampleRequestYearList = new ArrayList<ExampleRequestYear>();
// After initialisation, field is still null!
}
return this.exampleRequestYearList;
}
Also, switch to FetchType.EAGER solves this particular problem entirely. What am I missing?
Further details regarding app design. The Resource classes that handle HTTP requests interact with a set of Controller classes like this:
#Stateless(name = "ISomeActionController", mappedName = "ISomeActionController")
public class SomeActionController implements ISomeActionController {
#EJB
private IFooDAO fooDao;
#EJB
private IBarDAO barDao;
#Override
public ExampleRequest getExampleRequestById(Long exampleRequestId) {
return fooDao.getEntityById(exampleRequestId);
}
}
It's in the DAO classes where EntityManager is injected an used:
#Local
public interface IGenericDAO<T> {
public T persistEntity(T o);
public T persistEntityCommit(T o);
public void removeEntity(T o);
public void removeEntity(long id);
public T mergeEntity(T o);
public List<T> getEntitiesFindAll();
public List<T> getEntitiesFindAllActive();
public T getEntityById(Object id);
}
public interface IFooDAO extends IGenericDAO<ExampleRequest> {
public void flushDAO();
public ExampleRequest getExampleRequestById(Long exampleRequestId);
}
#Stateless(name = "IFooDAO", mappedName = "IFooDAO")
public class FooDAO extends GenericDAO<ExampleRequest> implements IFooDAO {
public FooDAO() {
super(ExampleRequest.class);
}
#Override
public void flushDAO(){
em.flush();
}
#Override
public ExampleRequest getExampleRequestById(Long exampleRequestId){
String sql = "...";
Query query = em.createNativeQuery(sql, ExampleRequest.class);
//...
}
}
enter image description hereI am new to Spring Boot Data JPA repository. This is my first application with JPA. I am trying to get data from DB. But which returns NULL.
Entity File
import javax.persistence.*;
#Entity
#Table(name = "TASK_DETAILS")
public class TaskDetails {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "TASK_DETAILS_ID")
private long taskDetailsId;
#Column(name = "TASK_NAME")
private String TaskName;
#Column(name = "TASK_POLLING_TIME")
private int TaskTime;
#Column(name = "TASK_FILE")
private String TaskClassFile;
#Column(name = "TASK_STATUS")
private String TaskStatus;
public long getTaskDetailsId() {
return taskDetailsId;
}
public void setTaskDetailsId(long taskDetailsId) {
this.taskDetailsId = taskDetailsId;
}
public String getTaskName() {
return TaskName;
}
public void setTaskName(String taskName) {
TaskName = taskName;
}
public int getTaskTime() {
return TaskTime;
}
public void setTaskTime(int taskTime) {
TaskTime = taskTime;
}
public String getTaskClassFile() {
return TaskClassFile;
}
public void setTaskClassFile(String taskClassFile) {
TaskClassFile = taskClassFile;
}
public String getTaskStatus() {
return TaskStatus;
}
public void setTaskStatus(String taskStatus) {
TaskStatus = taskStatus;
}
}
Repository File
import java.util.Collection;
import java.util.List;
import java.util.Optional;
#Repository
public interface TaskDetailsRepository extends JpaRepository<TaskDetails, String> {
TaskDetails findByTaskDetailsId(final long id);
}
My Main Method
#Service
public class ImportAmazonData {
#Autowired
private TaskDetailsRepository taskDetailsRepositoryDAO;
public void getProductsFromAmazonStore(JobExecutionContext context) throws ClassNotFoundException {
final long taskID = (long) context.getJobDetail().getJobDataMap().get("taskId");
TaskDetails taskDetails = taskDetailsRepositoryDAO.findByTaskDetailsId(taskID);
System.out.println("Result : " + taskDetails.getTaskClassFile());
}
}
ProductSync File
import com.example.Schedular.AmazonSync.ImportAmazonData;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.stereotype.Component;
public class ProductSync implements Job {
#Autowired
private ImportAmazonData importAmazonData;
#Override
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
importAmazonData.getProductsFromAmazonStore(context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
Here i am trying to get the TaskDetails by id. But my taskDetailsRepositoryDAO was null. Here i have attached my error log. Please let me know. Thanks in advance.
ERROR LOG
java.lang.NullPointerException: null
at com.example.Schedular.AmazonSync.ImportAmazonData.getProductsFromAmazonStore(ImportAmazonData.java:20) ~[classes/:na]
at com.example.Schedular.SyncData.ProductSync.execute(ProductSync.java:16) ~[classes/:na]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.2.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.2.jar:na]
In your repository file i.e TaskDetailsRepository should be as below :
import java.util.Collection;
import java.util.List;
import java.util.Optional;
#Repository
public interface TaskDetailsRepository extends JpaRepository<TaskDetails, Long> {
Optional<TaskDetails> findByTaskDetailsId(Long id);
}
Use wrappers instead of primitives in your domain classes.
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "TASK_DETAILS_ID")
private Long taskDetailsId;
If your are trying to find a record on basis of a particular value then specify that type i.e. Long.
And always use Optional if your method is going to return a sing record from database. this will help you resovle NullPointers.
This might help you.
Try adding this in your spring boot main file(I think it is SchedularApplication)
#EnableJpaRepositories("your jpa repository package name")
I have a REST service which serialize into the response some objects.
My entities ares annotated with XML but JAXB raised an illegalAnnotationExceptions...
Here the entities :
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name = "icns")
public class IcnList {
#XmlElement(required = true)
private List<IcnElement> icns;
public List<IcnElement> getIcns() {
return icns;
}
public void setIcns(List<IcnElement> icns) {
this.icns = icns;
}
}
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name = "icn")
public class IcnElement {
private String status;
private String revision;
private String icnName;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRevision() {
return revision;
}
public void setRevision(String revision) {
this.revision = revision;
}
public String getIcnName() {
return icnName;
}
public void setIcnName(String icnName) {
this.icnName = icnName;
}
}
Here the exception :
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Class has two properties of the same name "icns"
this problem is related to the following location:
at public java.util.List com.xx.model.IcnList.getIcns()
at com.xx.model.IcnList
this problem is related to the following location:
at private java.util.List com.xx.model.IcnList.icns
at com.xx.model.IcnList
Can someone tell me what is the problem ? and why ?
I made some research but I'm totally lost...
Thank you.
By default JAXB will treat public properties and annotated fields as mapped. The conflict is occurring in your mapping because JAXB thinks you have the following mappings:
A field called icns that is mapped to the element icns.
A property called icns that is mapped to the element icns.
This is causing your name conflict. You can eliminate the conflict by annotating the property (get or set method):
#XmlRootElement(name = "icns")
public class IcnList {
private List<IcnElement> icns;
#XmlElement(required = true)
public List<IcnElement> getIcns() {
return icns;
}
public void setIcns(List<IcnElement> icns) {
this.icns = icns;
}
}
Or if you wish to annotate the field you can use #XmlAccessorType(XmlAccessType.FIELD) at the class level.
#XmlRootElement(name = "icns")
#XmlAccessorType(XmlAccessType.FIELD)
public class IcnList {
#XmlElement(required = true)
private List<IcnElement> icns;
public List<IcnElement> getIcns() {
return icns;
}
public void setIcns(List<IcnElement> icns) {
this.icns = icns;
}
}
For More Information
http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html
Change the name of the root element
#XmlRootElement(name = "icns")
or, this element:
#XmlElement(required = true)
private List<IcnElement> icns;
Use #XmlType(name = "icn" ....) instead
How do I setup a basic OneToMany relationship using a List and get Hibernate JPA to manage the sequence index number of the list automagically? Can this be done?
This is my test case (more or less);
#Table(name="Policy_Root")
public class PolicyRoot extends BaseDomainModel {
private List<Policy> policyList = new ArrayList<Policy>();
#OneToMany(targetEntity=Policy.class, mappedBy="policyRoot", cascade=CascadeType.ALL)
#IndexColumn(name="policy_sequence", base=0, nullable=false)
public List<Policy> getPolicyList() {
return policyList;
}
public void setPolicyList(List<Policy> policyList) {
this.policyList = policyList;
}
public void addPolicy(Policy policy) {
policyList.add(policy);
policy.setPolicyRoot(this);
}
public void addPolicy(int sequence, Policy policy) {
policyList.add(sequence, policy);
policy.setPolicyRoot(this);
}
}
#Entity()
#Table(name="Policy")
public class Policy extends BaseDomainModel {
/** The position of this policy record within the list of policy's belong to the parent PolicyRoot */
private int policySequence;
/** Birectional pointer to parent */
private PolicyRoot policyRoot;
#Column(name="policy_sequence")
public int getPolicySequence() {
return policySequence;
}
public void setPolicySequence(int policySequence) {
this.policySequence = policySequence;
}
#ManyToOne
#JoinColumn(name="policy_root_oid", nullable=false)
public PolicyRoot getPolicyRoot() {
return policyRoot;
}
public void setPolicyRoot(PolicyRoot policyRoot) {
this.policyRoot = policyRoot;
}
}
#Test
public void testCreation() {
Policy policy1 = new Policy();
Policy policy2 = new Policy();
// Uncomment the following and the test case works - but I don't want to manage the sequence numbers
//policy2.setPolicySequence(1);
PolicyRoot policyRoot = new PolicyRoot();
policyRoot.addPolicy(policy1);
policyRoot.addPolicy(policy2);
ServiceImplFacade.getPersistenceFacade().persistSingleItem(policyRoot);
Long oid = policyRoot.getOid();
PolicyRoot policyRootFromDB = ServiceImplFacade.getPersistenceFacade().getEntityManager().find(PolicyRoot.class, oid);
assertEquals(2, policyRootFromDB.getPolicyList().size());
}
If I uncomment the policy2.setPolicySequence(1); line then the test case passes, but I don't think I need to do this. I want Hibernate to do this for me. My understanding is that it can, but if it can't then knowing that it can't would be a good answer as well.
I've tried various combinations of setting nullable, insertable and updateable but I may have missed one.
Is this possible? - If so how?
Found the answer, - it was around getting the right combinations of nullable and insertable. Also had to make the "child index" at Integer so that it could be nullable, and there's also an "optional" flag in the following as well.
public class PolicyRoot extends BordereauxBaseDomainModel {
private List<Policy> policyList = new ArrayList<Policy>();
#OneToMany(cascade=CascadeType.ALL)
#IndexColumn(name="policy_sequence", nullable=false, base=0)
#JoinColumn(name="policy_root_oid", nullable=false)
public List<Policy> getPolicyList() {
return policyList;
}
public void setPolicyList(List<Policy> policyList) {
this.policyList = policyList;
}
}
public class Policy extends BordereauxBaseDomainModel {
/** The position of this policy record within the list of policy's belong to the parent PolicyRoot */
private Integer policySequence;
/** Birectional pointer to parent */
private PolicyRoot policyRoot;
#Column(name="policy_sequence", insertable=false, updatable=false)
public Integer getPolicySequence() {
return policySequence;
}
public void setPolicySequence(Integer policySequence) {
this.policySequence = policySequence;
}
#ManyToOne(optional=false)
#JoinColumn(name="policy_root_oid", insertable=false, updatable=false, nullable=false)
public PolicyRoot getPolicyRoot() {
return policyRoot;
}
public void setPolicyRoot(PolicyRoot policyRoot) {
this.policyRoot = policyRoot;
}
}
Found the answers on the following page after searching Google for a while.
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4390
Do something like this:
#Entity
class Parent {
#OneToMany
#IndexColumn(name = "index_column")
List<Child> children;
}
#Entity
class Child {
#ManyToOne
Parent parent;
#Column(name = "index_column")
Integer index;
#PrePersist
#PreUpdate
private void prepareIndex() {
if (parent != null) {
index = parent.children.indexOf(this);
}
}
}
I'm going to post this answer since I recently had the same issue and this question, although outdated, keeps coming up in the researches.
The #IndexColumn annotation has been deprecated a long time ago and in its place it is best recommended using the #OrderColumn annotation. The second annotation not only simplifies its syntax without having to specify the base attribute, but it also avoids declaring an extra field in the detail class, in this case the policySequence field within the Policy class.
Here is the updated version of the previous snippet:
#Table(name="Policy_Root")
public class PolicyRoot extends BaseDomainModel {
private List<Policy> policyList = new ArrayList<Policy>();
#OneToMany(targetEntity=Policy.class, mappedBy="policyRoot", cascade=CascadeType.ALL)
#OrderColumn(name="policy_sequence", nullable=false)
public List<Policy> getPolicyList() {
return policyList;
}
public void setPolicyList(List<Policy> policyList) {
this.policyList = policyList;
}
public void addPolicy(Policy policy) {
policyList.add(policy);
policy.setPolicyRoot(this);
}
public void addPolicy(int sequence, Policy policy) {
policyList.add(sequence, policy);
policy.setPolicyRoot(this);
}
}
#Entity()
#Table(name="Policy")
public class Policy extends BaseDomainModel {
//No need to declare the policySequence field
/** Birectional pointer to parent */
private PolicyRoot policyRoot;
#Column(name="policy_sequence")
public int getPolicySequence() {
return policySequence;
}
public void setPolicySequence(int policySequence) {
this.policySequence = policySequence;
}
#ManyToOne
#JoinColumn(name="policy_root_oid", nullable=false)
public PolicyRoot getPolicyRoot() {
return policyRoot;
}
public void setPolicyRoot(PolicyRoot policyRoot) {
this.policyRoot = policyRoot;
}
}