app/src/main/java/db/juhaku/juhakudb/core/android/transaction/StoreTransactionTemplate.java
/**
     * Store cascade before the actual item is being stored. This stores items that the item itself
     * should refer to when being stored.
     *
     * @param item T item that is being cascade stored.
     *
     * @since 1.2.0
     *
     * @hide
     */
Store cascade before the actual item is being stored. This stores items that the item itself
should refer to when being stored.

@param item T item that is being cascade stored.



@hide
Store cascade before the actual item is being stored . This stores items that the item itself should refer to when being stored . @param item T item that is being cascade stored . @hide
private void cascadeStoreBefore(T item) {
        for (Field field : item.getClass().getDeclaredFields()) {
            Object value = ReflectionUtils.getFieldValue(item, field);
            /*
             * If field has foreign key relation it should be stored before the actual item is being
             * stored.
             */
            if (field.isAnnotationPresent(ManyToOne.class) ||
                    (field.isAnnotationPresent(OneToOne.class) && StringUtils.isBlank(field.getAnnotation(OneToOne.class).mappedBy()))) {
                if (value != null) {
                    store((Collection<T>) toCollection(value), null);
                }
            }
        }
    }
private void cascadeStoreBefore ( T item ) { for ( Field field : item . getClass ( ) . getDeclaredFields ( ) ) { Object value = ReflectionUtils . getFieldValue ( item , field ) ; /*
             * If field has foreign key relation it should be stored before the actual item is being
             * stored.
             */ if ( field . isAnnotationPresent ( ManyToOne . class ) || ( field . isAnnotationPresent ( OneToOne . class ) && StringUtils . isBlank ( field . getAnnotation ( OneToOne . class ) . mappedBy ( ) ) ) ) { if ( value != null ) { store ( ( Collection < T > ) toCollection ( value ) , null ) ; } } } }
Store cascade before the actual item is being stored.
Store cascade before the actual item is being stored .
// Check that there is actually something to store.