@ManyToMany(Authorship.class) Book[] getBooks(); }
private static void validateManyToManyAnnotation(final Method method) { final ManyToMany manyToMany = method.getAnnotation(ManyToMany.class); if (manyToMany != null) { final Class<? extends RawEntity<?>> throughType = manyToMany.value(); final String reverse = manyToMany.reverse(); if (reverse.length() != 0) { try { throughType.getMethod(reverse); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid reverse element value. It must be the name of the corresponding getter method on the joining entity.", exception); } } if (manyToMany.through().length() != 0) { try { throughType.getMethod(manyToMany.through()); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid through element value. It must be the name of the getter method on the joining entity that refers to the remote entities.", exception); } } } }
public static String where(ManyToMany manyToMany, final FieldNameConverter fnc) { return where(manyToMany.where(), fnc); }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchManyToMany(final RawEntity<K> proxy, final Method method, final ManyToMany manyToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> throughType = manyToManyAnnotation.value(); final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, null, Common.getMappingFields(getFieldNameConverter(), throughType, type), throughType, (Class<? extends RawEntity>) type, Common.where(manyToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, entityInfo.getEntityType()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, type)); }
public static String where(ManyToMany manyToMany, final FieldNameConverter fnc) { return where(manyToMany.where(), fnc); }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchManyToMany(final RawEntity<K> proxy, final Method method, final ManyToMany manyToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> throughType = manyToManyAnnotation.value(); final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, null, Common.getMappingFields(getFieldNameConverter(), throughType, type), throughType, (Class<? extends RawEntity>) type, Common.where(manyToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, entityInfo.getEntityType()), Common.getPolymorphicFieldNames(getFieldNameConverter(), throughType, type)); }
private static void validateManyToManyAnnotation(final Method method) { final ManyToMany manyToMany = method.getAnnotation(ManyToMany.class); if (manyToMany != null) { final Class<? extends RawEntity<?>> throughType = manyToMany.value(); final String reverse = manyToMany.reverse(); if (reverse.length() != 0) { try { throughType.getMethod(reverse); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid reverse element value. It must be the name of the corresponding getter method on the joining entity.", exception); } } if (manyToMany.through().length() != 0) { try { throughType.getMethod(manyToMany.through()); } catch (final NoSuchMethodException exception) { throw new IllegalArgumentException(method + " has a ManyToMany annotation with an invalid through element value. It must be the name of the getter method on the joining entity that refers to the remote entities.", exception); } } } }
@ManyToMany(Authorship.class) Author[] getAuthors(); }
private RawEntity[] fetchManyToMany(final Method method, final ManyToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final Class throughType = annotation.value(); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class); final Method reverseMethod = throughType.getMethod(annotation.reverse()); final Method throughMethod = throughType.getMethod(annotation.through()); final String reversePolymorphicTypeFieldName = getAttributeTypeFromMethod(reverseMethod).isAnnotationPresent(Polymorphic.class) ? getFieldNameConverter().getPolyTypeName(reverseMethod) : null; final String remotePolymorphicTypeFieldName = getAttributeTypeFromMethod(throughMethod).isAnnotationPresent(Polymorphic.class) ? getFieldNameConverter().getPolyTypeName(throughMethod) : null;
@ManyToMany(PersonChair.class) public Chair[] getChairs();
private RawEntity[] fetchManyToMany(final Method method, final ManyToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final Class throughType = annotation.value(); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class); final Method reverseMethod = throughType.getMethod(annotation.reverse()); final Method throughMethod = throughType.getMethod(annotation.through()); final String reversePolymorphicTypeFieldName = getAttributeTypeFromMethod(reverseMethod).isAnnotationPresent(Polymorphic.class) ? getFieldNameConverter().getPolyTypeName(reverseMethod) : null; final String remotePolymorphicTypeFieldName = getAttributeTypeFromMethod(throughMethod).isAnnotationPresent(Polymorphic.class) ? getFieldNameConverter().getPolyTypeName(throughMethod) : null;
@ManyToMany(Authorship.class) public Author[] getAuthors();
@ManyToMany(value = PersonSuit.class, where = "deleted = 'N'") public PersonLegalDefence[] getPersonLegalDefences(); }
@ManyToMany(PublicationToDistribution.class) public Distribution[] getDistributions(); }