/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchOneToMany(final RawEntity<K> proxy, final Method method, final OneToMany oneToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, new String[0], new String[]{Common.getPrimaryKeyField(type, getFieldNameConverter())}, (Class<? extends RawEntity>) type, where(oneToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), type, entityInfo.getEntityType())); }
private static DDLForeignKey[] parseForeignKeys(TableNameConverter nameConverter, FieldNameConverter fieldConverter, Class<? extends RawEntity<?>> clazz) { Set<DDLForeignKey> back = new LinkedHashSet<DDLForeignKey>(); for (Method method : clazz.getMethods()) { String attributeName = fieldConverter.getName(method); Class<?> type = Common.getAttributeTypeFromMethod(method); if (type != null && attributeName != null && RawEntity.class.isAssignableFrom(type) && type.getAnnotation(Polymorphic.class) == null) { DDLForeignKey key = new DDLForeignKey(); key.setField(attributeName); key.setTable(nameConverter.getName((Class<? extends RawEntity<?>>) type)); key.setForeignField(Common.getPrimaryKeyField((Class<? extends RawEntity<?>>) type, fieldConverter)); key.setDomesticTable(nameConverter.getName(clazz)); back.add(key); } } return back.toArray(new DDLForeignKey[back.size()]); }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity[] legacyFetchOneToMany(final RawEntity<K> proxy, final Method method, final OneToMany oneToManyAnnotation) throws SQLException { final Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType().getComponentType(); return retrieveRelations(proxy, new String[0], new String[]{Common.getPrimaryKeyField(type, getFieldNameConverter())}, (Class<? extends RawEntity>) type, where(oneToManyAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), type, entityInfo.getEntityType())); }
private static DDLForeignKey[] parseForeignKeys(TableNameConverter nameConverter, FieldNameConverter fieldConverter, Class<? extends RawEntity<?>> clazz) { Set<DDLForeignKey> back = new LinkedHashSet<DDLForeignKey>(); for (Method method : clazz.getMethods()) { String attributeName = fieldConverter.getName(method); Class<?> type = Common.getAttributeTypeFromMethod(method); if (type != null && attributeName != null && RawEntity.class.isAssignableFrom(type) && type.getAnnotation(Polymorphic.class) == null) { DDLForeignKey key = new DDLForeignKey(); key.setField(attributeName); key.setTable(nameConverter.getName((Class<? extends RawEntity<?>>) type)); key.setForeignField(Common.getPrimaryKeyField((Class<? extends RawEntity<?>>) type, fieldConverter)); key.setDomesticTable(nameConverter.getName(clazz)); back.add(key); } } return back.toArray(new DDLForeignKey[back.size()]); }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity legacyFetchOneToOne(final RawEntity<K> proxy, final Method method, final OneToOne oneToOneAnnotation) throws SQLException { Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType(); final RawEntity[] back = retrieveRelations(proxy, new String[0], new String[]{Common.getPrimaryKeyField(type, getFieldNameConverter())}, (Class<? extends RawEntity>) type, Common.where(oneToOneAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), type, entityInfo.getEntityType())); return back.length == 0 ? null : back[0]; }
/** * @see <a href="https://studio.atlassian.com/browse/AO-325">AO-325</a> */ @Deprecated private RawEntity legacyFetchOneToOne(final RawEntity<K> proxy, final Method method, final OneToOne oneToOneAnnotation) throws SQLException { Class<? extends RawEntity<?>> type = (Class<? extends RawEntity<?>>) method.getReturnType(); final RawEntity[] back = retrieveRelations(proxy, new String[0], new String[]{Common.getPrimaryKeyField(type, getFieldNameConverter())}, (Class<? extends RawEntity>) type, Common.where(oneToOneAnnotation, getFieldNameConverter()), Common.getPolymorphicFieldNames(getFieldNameConverter(), type, entityInfo.getEntityType())); return back.length == 0 ? null : back[0]; }
String finalPKField = Common.getPrimaryKeyField(finalType, getFieldNameConverter()); sql.append(tableAlias).append('.').append(provider.processID(Common.getPrimaryKeyField(type, getFieldNameConverter()))); sql.append(" AS ").append(provider.quote(throughField)).append(','); throughField = Common.getPrimaryKeyField(type, getFieldNameConverter());
private RawEntity[] fetchOneToMany(final Method method, final OneToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final EntityInfo entityInfo = manager.resolveEntityInfo(remoteType); final String remotePrimaryKeyFieldName = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); final String whereClause = where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class);
String finalPKField = Common.getPrimaryKeyField(finalType, getFieldNameConverter()); sql.append(tableAlias).append('.').append(provider.processID(Common.getPrimaryKeyField(type, getFieldNameConverter()))); sql.append(" AS ").append(provider.quote(throughField)).append(','); throughField = Common.getPrimaryKeyField(type, getFieldNameConverter());
private RawEntity[] fetchOneToMany(final Method method, final OneToMany annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType().getComponentType(); final EntityInfo entityInfo = manager.resolveEntityInfo(remoteType); final String remotePrimaryKeyFieldName = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); final String whereClause = where(annotation, getFieldNameConverter()); final Preload preloadAnnotation = (Preload) remoteType.getAnnotation(Preload.class);
private RawEntity fetchOneToOne(final Method method, final OneToOne annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType(); final EntityInfo entityInfo = manager.resolveEntityInfo(remoteType); final String remotePrimaryKeyFieldName = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Method remoteMethod = remoteType.getMethod(annotation.reverse());
final String remotePrimaryKeyField = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); if (!selectFields.isEmpty()) { final String remoteTable = provider.withSchema(getTableNameConverter().getName(remoteType));
final String remotePrimaryKeyField = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); if (!selectFields.isEmpty()) { final String remoteTable = provider.withSchema(getTableNameConverter().getName(remoteType));
private RawEntity fetchOneToOne(final Method method, final OneToOne annotation) throws SQLException, NoSuchMethodException { final Class remoteType = method.getReturnType(); final EntityInfo entityInfo = manager.resolveEntityInfo(remoteType); final String remotePrimaryKeyFieldName = Common.getPrimaryKeyField(remoteType, getFieldNameConverter()); final String whereClause = Common.where(annotation, getFieldNameConverter()); final Method remoteMethod = remoteType.getMethod(annotation.reverse());