protected FieldInfo buildFieldInfo(Field field) { FieldInfo info = new FieldInfo(); info.setName(field.getName()); info.setGenericType(field.getGenericType()); ManyToMany manyToMany = field.getAnnotation(ManyToMany.class); if (manyToMany != null) { info.setManyToManyMappedBy(manyToMany.mappedBy()); info.setManyToManyTargetEntity(manyToMany.targetEntity().getName()); } OneToMany oneToMany = field.getAnnotation(OneToMany.class); if (oneToMany != null) { info.setOneToManyMappedBy(oneToMany.mappedBy()); info.setOneToManyTargetEntity(oneToMany.targetEntity().getName()); } return info; }
private static String getMappedByFromAnnotation(CtField persistentField) { OneToOne oto = PersistentAttributesHelper.getAnnotation( persistentField, OneToOne.class ); if ( oto != null ) { return oto.mappedBy(); } OneToMany otm = PersistentAttributesHelper.getAnnotation( persistentField, OneToMany.class ); if ( otm != null ) { return otm.mappedBy(); } // For @ManyToOne associations, mappedBy must come from the @OneToMany side of the association ManyToMany mtm = PersistentAttributesHelper.getAnnotation( persistentField, ManyToMany.class ); return mtm == null ? "" : mtm.mappedBy(); }
protected FieldInfo buildFieldInfo(Field field) { FieldInfo info = new FieldInfo(); info.setName(field.getName()); info.setGenericType(field.getGenericType()); ManyToMany manyToMany = field.getAnnotation(ManyToMany.class); if (manyToMany != null) { info.setManyToManyMappedBy(manyToMany.mappedBy()); info.setManyToManyTargetEntity(manyToMany.targetEntity().getName()); } OneToMany oneToMany = field.getAnnotation(OneToMany.class); if (oneToMany != null) { info.setOneToManyMappedBy(oneToMany.mappedBy()); info.setOneToManyTargetEntity(oneToMany.targetEntity().getName()); } MapKey mapKey = field.getAnnotation(MapKey.class); if (mapKey != null) { info.setMapKey(mapKey.name()); } return info; }
Property ruleProperty = populateValueRequest.getProperty(); String jsonPropertyValue = ruleProperty.getUnHtmlEncodedValue(); String mappedByEntity = oneToMany.mappedBy(); dirty = updateQuantityRule( entityManager, translator, entityKey,
OneToMany oneToMany = field.getAnnotation(OneToMany.class); Object parent = extractParent(populateValueRequest, instance); populateValueRequest.getFieldManager().setFieldValue(rule, oneToMany.mappedBy(), parent); populateValueRequest.getFieldManager().setFieldValue(rule, populateValueRequest.getMetadata(). getMapKeyValueProperty(), prop.substring(prop.indexOf(
defaultToJoinTable = defaultToJoinTable && ( ( annotationClass == ManyToMany.class && StringHelper.isEmpty( ( (ManyToMany) annotation ).mappedBy() ) ) || ( annotationClass == OneToMany.class && StringHelper.isEmpty( ( (OneToMany) annotation ).mappedBy() ) ) || ( annotationClass == ElementCollection.class ) );
OneToMany oneToMany = property.getAnnotation( OneToMany.class ); String mappedBy = oneToMany != null ? oneToMany.mappedBy() : ""; joinColumns = Ejb3JoinColumn.buildJoinColumns(
Arrays.asList(ann.cascade()), Boolean.TRUE, ann.mappedBy(), Relation.ForeignKey.ONE_TO_MANY);
/** * INTERNAL: (Overridden in XMLOneToManyAccessor) */ public String getMappedBy() { return (m_oneToMany == null) ? "" : m_oneToMany.mappedBy(); }
@Override protected String getMappedBy(Field field) { return field.getAnnotation(OneToMany.class).mappedBy(); } @Override
/** * Wyciąga wartość z annotacji OneToMany.mappedBy. */ private static String getMappedBy(Method m) { //czy metoda ma annotację @OneToMany? OneToMany oneToManyAnnotation = m.getAnnotation( OneToMany.class ); if (oneToManyAnnotation == null) return null; return oneToManyAnnotation.mappedBy(); }
private void readToOne(OneToMany propAnn, DeployBeanPropertyAssocMany<?> manyProp) { manyProp.setMappedBy(propAnn.mappedBy()); manyProp.setFetchType(propAnn.fetch()); setCascadeTypes(propAnn.cascade(), manyProp.getCascadeInfo()); Class<?> targetType = propAnn.targetEntity(); if (targetType.equals(void.class)) { // via reflection of generics type targetType = manyProp.getTargetType(); } else { manyProp.setTargetType(targetType); } BeanTable assoc = factory.getBeanTable(targetType); if (assoc == null) { throw new BeanNotRegisteredException(errorMsgMissingBeanTable(targetType, manyProp.getFullBeanName())); } manyProp.setBeanTable(assoc); manyProp.getTableJoin().setType(SqlJoinType.OUTER); }
mappedBy = oneToManyAnn.mappedBy(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( oneToManyAnn.targetEntity() )
protected String getInverseField(Field field) { OneToMany oneToManyAnnotation = field.getAnnotation(OneToMany.class); if (oneToManyAnnotation != null) return isBlank(oneToManyAnnotation.mappedBy()) ? null : oneToManyAnnotation.mappedBy(); ManyToMany manyToManyAnnotation = field.getAnnotation(ManyToMany.class); if (manyToManyAnnotation != null) return isBlank(manyToManyAnnotation.mappedBy()) ? null : manyToManyAnnotation.mappedBy(); OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class); if (oneToOneAnnotation != null) return isBlank(oneToOneAnnotation.mappedBy()) ? null : oneToOneAnnotation.mappedBy(); return null; }
defaultToJoinTable = defaultToJoinTable && ( ( annotationClass == ManyToMany.class && StringHelper.isEmpty( ( (ManyToMany) annotation ).mappedBy() ) ) || ( annotationClass == OneToMany.class && StringHelper.isEmpty( ( (OneToMany) annotation ).mappedBy() ) ) || ( annotationClass == CollectionOfElements.class ) //legacy Hibernate || ( annotationClass == ElementCollection.class )
OneToMany oneToMany = property.getAnnotation( OneToMany.class ); String mappedBy = oneToMany != null ? oneToMany.mappedBy() : ""; joinColumns = Ejb3JoinColumn.buildJoinColumns(
private void introspectOneToMany(OneToMany oneToMany) { Class targetClass = oneToMany.targetEntity(); if (! void.class.equals(targetClass)) setTargetEntity(targetClass); setCascadeTypes(oneToMany.cascade()); setFetch(oneToMany.fetch()); _mappedBy = oneToMany.mappedBy(); }
mappedBy = oneToManyAnn.mappedBy(); collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( oneToManyAnn.targetEntity() )