private String getMappedBy(MetaAttribute attr) {
ManyToMany manyManyAnnotation = attr.getAnnotation(ManyToMany.class);
OneToMany oneManyAnnotation = attr.getAnnotation(OneToMany.class);
OneToOne oneOneAnnotation = attr.getAnnotation(OneToOne.class);
String mappedBy = null;
if (manyManyAnnotation != null) {
mappedBy = manyManyAnnotation.mappedBy();
}
if (oneManyAnnotation != null) {
mappedBy = oneManyAnnotation.mappedBy();
}
if (oneOneAnnotation != null) {
mappedBy = oneOneAnnotation.mappedBy();
}
if (mappedBy != null && mappedBy.length() == 0) {
mappedBy = null;
}
return mappedBy;
}
java类javax.persistence.OneToMany的实例源码
JpaMetaFilter.java 文件源码
项目:crnk-framework
阅读 38
收藏 0
点赞 0
评论 0
JpaResourceFieldInformationProvider.java 文件源码
项目:crnk-framework
阅读 56
收藏 0
点赞 0
评论 0
@Override
public Optional<SerializeType> getSerializeType(BeanAttributeInformation attributeDesc) {
Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
if (oneToMany.isPresent()) {
return toSerializeType(oneToMany.get().fetch());
}
Optional<ManyToOne> manyToOne = attributeDesc.getAnnotation(ManyToOne.class);
if (manyToOne.isPresent()) {
return toSerializeType(manyToOne.get().fetch());
}
Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
if (manyToMany.isPresent()) {
return toSerializeType(manyToMany.get().fetch());
}
Optional<ElementCollection> elementCollection = attributeDesc.getAnnotation(ElementCollection.class);
if (elementCollection.isPresent()) {
return toSerializeType(elementCollection.get().fetch());
}
return Optional.empty();
}
LanguageBundle.java 文件源码
项目:Equella
阅读 35
收藏 0
点赞 0
评论 0
@OneToMany(cascade = CascadeType.ALL, mappedBy = "bundle")
@Fetch(value = FetchMode.SELECT)
@MapKey(name = "locale")
public Map<String, LanguageString> getStrings()
{
return strings;
}
EnhancementTask.java 文件源码
项目:lams
阅读 40
收藏 0
点赞 0
评论 0
@Override
public boolean isMappedCollection(CtField field) {
try {
return (field.getAnnotation(OneToMany.class) != null ||
field.getAnnotation(ManyToMany.class) != null ||
field.getAnnotation(ElementCollection.class) != null);
}
catch (ClassNotFoundException e) {
return false;
}
}
ReflectiveClone.java 文件源码
项目:oscm
阅读 33
收藏 0
点赞 0
评论 0
private static boolean needsToCascade(Field field) {
Class<?> fieldtype = field.getType();
if (!DomainObject.class.isAssignableFrom(fieldtype))
return false;
Annotation ann;
CascadeType[] cascades = null;
ann = field.getAnnotation(OneToOne.class);
if (ann != null) {
cascades = ((OneToOne) ann).cascade();
} else {
ann = field.getAnnotation(OneToMany.class);
if (ann != null) {
cascades = ((OneToMany) ann).cascade();
} else {
ann = field.getAnnotation(ManyToOne.class);
if (ann != null) {
cascades = ((ManyToOne) ann).cascade();
} else {
ann = field.getAnnotation(ManyToMany.class);
if (ann != null) {
cascades = ((ManyToMany) ann).cascade();
}
}
}
}
if (cascades == null)
return false;
for (CascadeType cas : cascades) {
if ((cas == CascadeType.ALL) || (cas == CascadeType.MERGE)
|| (cas == CascadeType.PERSIST)
|| (cas == CascadeType.REMOVE)) {
return true;
}
}
return false;
}
JpaResourceFieldInformationProvider.java 文件源码
项目:crnk-framework
阅读 42
收藏 0
点赞 0
评论 0
@Override
public Optional<String> getOppositeName(BeanAttributeInformation attributeDesc) {
Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
if (oneToMany.isPresent()) {
return Optional.ofNullable(StringUtils.emptyToNull(oneToMany.get().mappedBy()));
}
Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
if (manyToMany.isPresent()) {
return Optional.ofNullable(StringUtils.emptyToNull(manyToMany.get().mappedBy()));
}
return Optional.empty();
}
PropertyContainer.java 文件源码
项目:lams
阅读 34
收藏 0
点赞 0
评论 0
private static boolean discoverTypeWithoutReflection(XProperty p) {
if ( p.isAnnotationPresent( OneToOne.class ) && !p.getAnnotation( OneToOne.class )
.targetEntity()
.equals( void.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( OneToMany.class ) && !p.getAnnotation( OneToMany.class )
.targetEntity()
.equals( void.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( ManyToOne.class ) && !p.getAnnotation( ManyToOne.class )
.targetEntity()
.equals( void.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( ManyToMany.class ) && !p.getAnnotation( ManyToMany.class )
.targetEntity()
.equals( void.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( ManyToAny.class ) ) {
if ( !p.isCollection() && !p.isArray() ) {
throw new AnnotationException( "@ManyToAny used on a non collection non array property: " + p.getName() );
}
return true;
}
else if ( p.isAnnotationPresent( Type.class ) ) {
return true;
}
else if ( p.isAnnotationPresent( Target.class ) ) {
return true;
}
return false;
}
BlogEntry.java 文件源码
项目:java-course
阅读 44
收藏 0
点赞 0
评论 0
/**
* Get all comments for current blog entry.
*
* @return List of all comments for current blog entry.
*/
@OneToMany(mappedBy = "blogEntry", fetch = FetchType.LAZY,
cascade = CascadeType.PERSIST, orphanRemoval = true)
@OrderBy("postedOn")
public List<BlogComment> getComments() {
return comments;
}
EventSupport.java 文件源码
项目:jkes
阅读 34
收藏 0
点赞 0
评论 0
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;
}
QUser.java 文件源码
项目:sbc-qsystem
阅读 37
收藏 0
点赞 0
评论 0
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "user_id", insertable = false, nullable = false, updatable = false)
// MOSCOW
@Fetch(FetchMode.SELECT)
// Это отсечение дублирования при джойне таблици, т.к. в QPlanService есть @OneToOne к QService, и в нем есть @OneToMany к QServiceLang - дублится по
// количеству переводов
// This is the truncation of the duplication when the table joins, since In QPlanService there is @OneToOne to QService, and there is @OneToMany to
// QServiceLang - it is duplicated by the number of translations.
public List<QPlanService> getPlanServices() {
return planServices;
}
GoodsBrand8JPA.java 文件源码
项目:tinyshop8
阅读 37
收藏 0
点赞 0
评论 0
@OneToMany(targetEntity = Goods8JPA.class, cascade = REMOVE,
fetch = EAGER)
@JoinColumn(name = "join_goods_brand_m2o", foreignKey =
@ForeignKey(name = "fk_goods_brand_m2o"))
@JoinTable(name = "jpa_goods_brand_set", foreignKey =
@ForeignKey(name = "fk_jpa_goods_brand_set"))
public Set<Goods8JPA> getGoods8JPASet()
{
return goods8JPASet;
}
DiskShare.java 文件源码
项目:lemon
阅读 31
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "diskShare")
public Set<DiskAcl> getDiskAcls() {
return this.diskAcls;
}
Product.java 文件源码
项目:GitHub
阅读 39
收藏 0
点赞 0
评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="product")
public Set<OrderDetail> getOrderDetails() {
return this.orderDetails;
}
Office.java 文件源码
项目:GitHub
阅读 36
收藏 0
点赞 0
评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="office")
public Set<Employee> getEmployees() {
return this.employees;
}
Company.java 文件源码
项目:DocIT
阅读 38
收藏 0
点赞 0
评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="company")
public Set<Employee> getEmployees() {
return this.employees;
}
Department.java 文件源码
项目:DocIT
阅读 37
收藏 0
点赞 0
评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="department")
public Set<Employee> getEmployees() {
return this.employees;
}
Department.java 文件源码
项目:DocIT
阅读 33
收藏 0
点赞 0
评论 0
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="department")
public Set<Department> getDepartments() {
return this.departments;
}
WhitelistPackage.java 文件源码
项目:lemon
阅读 34
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "whitelistPackage")
public Set<WhitelistService> getWhitelistServices() {
return this.whitelistServices;
}
SystemMenu.java 文件源码
项目:plumdo-work
阅读 32
收藏 0
点赞 0
评论 0
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "systemMenu")
public Set<SystemMenu> getSystemMenus() {
return this.systemMenus;
}
TicketCatalog.java 文件源码
项目:lemon
阅读 35
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "ticketCatalog")
public Set<TicketInfo> getTicketInfos() {
return this.ticketInfos;
}
User.java 文件源码
项目:aws-photosharing-example
阅读 36
收藏 0
点赞 0
评论 0
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Share> getShares() {return shares;}
TicketGroup.java 文件源码
项目:lemon
阅读 40
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "ticketGroup")
public Set<TicketMember> getTicketMembers() {
return this.ticketMembers;
}
BookInfo.java 文件源码
项目:lemon
阅读 35
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "bookInfo")
public Set<BookBorrow> getBookBorrows() {
return this.bookBorrows;
}
FeedbackCatalog.java 文件源码
项目:lemon
阅读 31
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "feedbackCatalog")
public Set<FeedbackInfo> getFeedbackInfos() {
return this.feedbackInfos;
}
Album.java 文件源码
项目:aws-photosharing-example
阅读 30
收藏 0
点赞 0
评论 0
@OneToMany(mappedBy = "album", orphanRemoval=true)
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Share> getShares() {return shares;}
BpmCategory.java 文件源码
项目:lemon
阅读 36
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "bpmCategory")
@OrderBy("priority")
public Set<BpmProcess> getBpmProcesses() {
return this.bpmProcesses;
}
WhitelistService.java 文件源码
项目:lemon
阅读 30
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "whitelistService")
public Set<WhitelistInfo> getWhitelistInfos() {
return this.whitelistInfos;
}
BpmProcess.java 文件源码
项目:lemon
阅读 35
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "bpmProcess")
public Set<BpmTaskDefNotice> getBpmTaskDefNotices() {
return this.bpmTaskDefNotices;
}
BpmProcess.java 文件源码
项目:lemon
阅读 36
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "bpmProcess")
public Set<BpmInstance> getBpmInstances() {
return this.bpmInstances;
}
JavamailConfig.java 文件源码
项目:lemon
阅读 33
收藏 0
点赞 0
评论 0
/** @return . */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "javamailConfig")
public Set<JavamailMessage> getJavamailMessages() {
return this.javamailMessages;
}