app/src/main/java/db/juhaku/juhakudb/core/android/transaction/StoreTransactionTemplate.java
/**
     * Store cascade after the item was stored to database. This stores items that are referenced
     * by the item itself.
     *
     * @param item T item that is being cascade stored.
     *
     * @since 1.2.0
     *
     * @hide
     */
Store cascade after the item was stored to database. This stores items that are referenced
by the item itself.

@param item T item that is being cascade stored.



@hide
Store cascade after the item was stored to database . This stores items that are referenced by the item itself . @param item T item that is being cascade stored . @hide
private void cascadeStoreAfter(T item) {
        for (Field field : item.getClass().getDeclaredFields()) {
            Object value = ReflectionUtils.getFieldValue(item, field);
            /*
             * If field has primary key relation referenced item will be stored after the actual item
             * is being stored.
             */
            if (field.isAnnotationPresent(ManyToMany.class) || field.isAnnotationPresent(OneToMany.class)
                    || (field.isAnnotationPresent(OneToOne.class) && !StringUtils.isBlank(field.getAnnotation(OneToOne.class).mappedBy()))) {
                if (value != null) {
                    if (field.isAnnotationPresent(ManyToMany.class)) {
                        store((Collection<T>) toCollection(value), null);
                        storeMiddleTable(item, (Collection<T>) value);
                    } else {
                        store((Collection<T>) toCollection(value), item);
                    }
                }
            }
        }
    }
private void cascadeStoreAfter ( T item ) { for ( Field field : item . getClass ( ) . getDeclaredFields ( ) ) { Object value = ReflectionUtils . getFieldValue ( item , field ) ; /*
             * If field has primary key relation referenced item will be stored after the actual item
             * is being stored.
             */ if ( field . isAnnotationPresent ( ManyToMany . class ) || field . isAnnotationPresent ( OneToMany . class ) || ( field . isAnnotationPresent ( OneToOne . class ) && ! StringUtils . isBlank ( field . getAnnotation ( OneToOne . class ) . mappedBy ( ) ) ) ) { if ( value != null ) { if ( field . isAnnotationPresent ( ManyToMany . class ) ) { store ( ( Collection < T > ) toCollection ( value ) , null ) ; storeMiddleTable ( item , ( Collection < T > ) value ) ; } else { store ( ( Collection < T > ) toCollection ( value ) , item ) ; } } } } }
Store cascade after the item was stored to database.
Store cascade after the item was stored to database .
// Check that there is actually something to store. // Update middle table reference for many to many relations.