下面列出了怎么用javax.persistence.OneToMany的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Gets the detail list.
*
* @return the detail list
*/
@OneToMany(targetEntity = DetailData.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DETAIL_LIST_PERSON_DETAIL_DA_0")
public List<DetailData> getDetailList() {
return this.detailList;
}
/**
* Get the position entries for this object.
*/
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true, mappedBy = "auftrag")
@IndexColumn(name = "number", base = 1)
public List<AuftragsPositionDO> getPositionen()
{
return this.positionen;
}
@OneToMany(targetEntity = ControlMessage.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
public List<ControlMessage> getControlMessage() {
if (controlledMessage == null) {
controlledMessage = new ArrayList<ControlMessage>();
}
return this.controlledMessage;
}
/**
* Gets the document attachment list.
*
* @return the document attachment list
*/
@OneToMany(targetEntity = DocumentAttachment.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DOCUMENT_ATTACHMENT_LIST_DOC_0")
public List<DocumentAttachment> getDocumentAttachmentList() {
return this.documentAttachmentList;
}
private CascadeType[] getCascadeTypes(AccessibleObject accessibleObject) {
CascadeType[] cascadeTypes = null;
if(accessibleObject.isAnnotationPresent(OneToMany.class)) {
cascadeTypes = accessibleObject.getAnnotation(OneToMany.class).cascade();
}else if(accessibleObject.isAnnotationPresent(ManyToOne.class)) {
cascadeTypes = accessibleObject.getAnnotation(ManyToOne.class).cascade();
}else if(accessibleObject.isAnnotationPresent(ManyToMany.class)) {
cascadeTypes = accessibleObject.getAnnotation(ManyToMany.class).cascade();
}
return cascadeTypes;
}
/**
* @return the configuration
*/
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumns({
@JoinColumn(name = "clusterId", referencedColumnName = "clusterId"),
@JoinColumn(name = "host", referencedColumnName = "publicIp") })
public List<Configuration> getConfiguration() {
return configuration;
}
/**
* @return the configuration
*/
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumns({
@JoinColumn(name = "clusterId", referencedColumnName = "clusterId"),
@JoinColumn(name = "host", referencedColumnName = "publicIp") })
public List<Event> getEvents() {
return events;
}
@OneToMany(cascade = CascadeType.ALL)
public List<EItem> getEItems() {
if (eItems == null) {
eItems = new ArrayList<EItem>();
}
if (ItemUtils.shouldBeWrapped(e))
e = ItemUtils.wrap(e, eItems, EItem.class);
return this.eItems;
}
@Cascade(CascadeType.ALL)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taskData")
@OnDelete(action = OnDeleteAction.CASCADE)
@OrderColumn(name = "SCRIPT_ORDER")
public List<SelectionScriptData> getSelectionScripts() {
return selectionScripts;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "billingAddress")
public Set<BillingStatement> getBillingStatements() {
return this.billingStatements;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "htHumantask")
public Set<HtHumantask> getHtHumantasks() {
return this.htHumantasks;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "tbldepartment")
public Set<Tblcourses> getTblcourseses() {
return this.tblcourseses;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tmodelInstanceInfo")
@OrderBy
public List<InstanceDetailsDescr> getInstanceDetailsDescrs() {
return this.instanceDetailsDescrs;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "cmsSite")
public Set<CmsCatalog> getCmsCatalogs() {
return this.cmsCatalogs;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "childEntity")
public Set<PartyStruct> getParentStructs() {
return this.parentStructs;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "diskInfo")
public Set<DiskShare> getDiskShares() {
return this.diskShares;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "sendmailTemplate")
public Set<SendmailAttachment> getSendmailAttachments() {
return this.sendmailAttachments;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "sysCategory")
public Set<SysEntry> getSysEntries() {
return this.sysEntries;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "sendmailApp")
public Set<SendmailHistory> getSendmailHistories() {
return this.sendmailHistories;
}
@JsonBackReference("booked-data")
@OneToMany(fetch = FetchType.LAZY, mappedBy = "trip")
public Set<BookedTrip> getBookedTrips() {
return this.bookedTrips;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "modelBase")
public Set<ModelItem> getModelItems() {
return this.modelItems;
}
@OneToMany(mappedBy="document",cascade={CascadeType.ALL})
public Set<DocumentProperty> getProps() {
return props;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "modelBase")
public Set<ModelRow> getModelRows() {
return this.modelRows;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "diskShare")
public Set<DiskMember> getDiskMembers() {
return this.diskMembers;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "taskInfo")
public Set<TaskParticipant> getTaskParticipants() {
return this.taskParticipants;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "partyStructType")
public Set<PartyStruct> getPartyStructs() {
return this.partyStructs;
}
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "cmsArticle")
public Set<CmsTagArticle> getCmsTagArticles() {
return this.cmsTagArticles;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "redeployType")
public Set<EmployeeRedeploy> getEmployeeRedeploys() {
return employeeRedeploys;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "permission")
public Set<RolePermission> getRolePermissions() {
return this.rolePermissions;
}
/**
* @return Children.
*/
@OneToMany(cascade = javax.persistence.CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "ENTITY_ID")
public Collection<ChildEntity> getChildren() {
return children;
}