Package com.spaceprogram.simplejpa

Examples of com.spaceprogram.simplejpa.AnnotationInfo


        init(em);
    }

    private Boolean appendCondition(Class tClass, StringBuilder sb, String field, String comparator, String param) {
        comparator = comparator.toLowerCase();
        AnnotationInfo ai = em.getAnnotationManager().getAnnotationInfo(tClass);

        String fieldSplit[] = field.split("\\.");
        if (fieldSplit.length == 1) {
            field = fieldSplit[0];
// System.out.println("split: " + field + " param=" + param);
            if (field.equals(param)) {
                return false;
            }
        } else if (fieldSplit.length == 2) {
            field = fieldSplit[1];
        } else if (fieldSplit.length == 3) {
            // NOTE: ONLY SUPPORTING SECOND LEVEL OF GRAPH RIGHT NOW
            // then we have to reach down the graph here. eg: myOb.ob2.name or myOb.ob2.id
            // if filtering by id, then don't need to query for second object, just add a filter on the id field
            String refObjectField = fieldSplit[1];
            field = fieldSplit[2];
// System.out.println("field=" + field);
            Method getterForReference = ai.getGetter(refObjectField);
            Class refType = getterForReference.getReturnType();
            AnnotationInfo refAi = em.getAnnotationManager().getAnnotationInfo(refType);
            Method getterForField = refAi.getGetter(field);
// System.out.println("getter=" + getterForField);
            String paramValue = getParamValueAsStringForAmazonQuery(param, getterForField);
            logger.finest("paramValue=" + paramValue);
            Method refIdMethod = refAi.getIdMethod();
            if (NamingHelper.attributeName(refIdMethod).equals(field)) {
                logger.finer("Querying using id field, no second query required.");
                appendFilter(sb, NamingHelper.foreignKey(refObjectField), comparator, paramValue);
            } else {
                // no id method, so query for other object(s) first, then apply the returned value to the original query.
View Full Code Here


        boolean count = false;
        if (select != null && select.contains("count")) {
// System.out.println("HAS COUNT: " + select);
            count = true;
        }
        AnnotationInfo ai = em.getAnnotationManager().getAnnotationInfo(tClass);

        // Make sure querying the root Entity class
        String domainName = em.getDomainName(ai.getRootClass());
        if (domainName == null) {
            return null;
// throw new NoResultsException();
        }
        StringBuilder amazonQuery;
        if (q.getFilter() != null) {
            amazonQuery = toAmazonQuery(tClass, q);
            if (amazonQuery == null) {
// throw new NoResultsException();
                return null;
            }
        } else {
            amazonQuery = new StringBuilder();
        }
        if (ai.getDiscriminatorValue() != null) {
            if (amazonQuery.length() == 0) {
                amazonQuery = new StringBuilder();
            } else {
                amazonQuery.append(" and ");
            }
            appendFilter(amazonQuery, EntityManagerFactoryImpl.DTYPE, "=", "'" + ai.getDiscriminatorValue() + "'");
        }

        // now for sorting
        String orderBy = q.getOrdering();
        if (orderBy != null && orderBy.length() > 0) {
View Full Code Here

        String id = em.getId(o);
        if (id == null) {
            newObject = true;
            id = UUID.randomUUID().toString();
//            System.out.println("new object, setting id");
            AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);
            em.setFieldValue(o.getClass(), o, ai.getIdMethod(), id);
        }
        em.cachePut(id, o);
        return id;
    }
View Full Code Here

    }

    protected void persistOnly(Object o, String id) throws AmazonClientException, IllegalAccessException, InvocationTargetException, IOException {
        long start = System.currentTimeMillis();
        em.invokeEntityListener(o, newObject ? PrePersist.class : PreUpdate.class);
        AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);
        String domainName;
        if (ai.getRootClass() != null) {
          domainName = em.getOrCreateDomain(ai.getRootClass());
        } else {
          domainName = em.getOrCreateDomain(o.getClass());
        }       
//        Item item = DomainHelper.findItemById(this.em.getSimpleDb(), domainName, id);
        // now set attributes
        List<ReplaceableAttribute> attsToPut = new ArrayList<ReplaceableAttribute>();
        List<Attribute> attsToDelete = new ArrayList<Attribute>();
        if (ai.getDiscriminatorValue() != null) {
            attsToPut.add(new ReplaceableAttribute(EntityManagerFactoryImpl.DTYPE, ai.getDiscriminatorValue(), true));
        }

        LazyInterceptor interceptor = null;
        if (o instanceof Factory) {
            Factory factory = (Factory) o;
            /*for (Callback callback2 : factory.getCallbacks()) {
                if(logger.isLoggable(Level.FINER)) logger.finer("callback=" + callback2);
                if (callback2 instanceof LazyInterceptor) {
                    interceptor = (LazyInterceptor) callback2;
                }
            }*/
            interceptor = (LazyInterceptor) factory.getCallback(0);
        }

        Collection<Method> getters = ai.getGetters();
        for (Method getter : getters) {
          Object ob;
          try
          {
            ob = getter.invoke(o);
          }
          catch (Exception e)
          {
            throw new PersistenceException("Failed invoking getter: " + getter, e);
          }
         
            String columnName = NamingHelper.getColumnName(getter);
            if (ob == null) {
                attsToDelete.add(new Attribute(columnName, null));
                continue;
            }
            if (getter.getAnnotation(ManyToOne.class) != null) {
                // store the id of this object
                String id2 = em.getId(ob);
                attsToPut.add(new ReplaceableAttribute(columnName, id2, true));
            } else if (getter.getAnnotation(OneToMany.class) != null) {
                // FORCING BI-DIRECTIONAL RIGHT NOW SO JUST IGNORE
            } else if (getter.getAnnotation(Lob.class) != null) {
                // store in s3
                AmazonS3 s3 = null;
                // todo: need to make sure we only store to S3 if it's changed, too slow.
                logger.fine("putting lob to s3");
                long start3 = System.currentTimeMillis();
                s3 = em.getS3Service();
                String bucketName = em.getS3BucketName();
                String s3ObjectId = em.s3ObjectId(id, getter);

                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                ObjectOutputStream out = new ObjectOutputStream(bos);
                out.writeObject(ob);
                byte[] contentBytes = bos.toByteArray();
                out.close();
                InputStream input = new ByteArrayInputStream(contentBytes);
               
                s3.putObject(bucketName, s3ObjectId, input, null);
               
                em.statsS3Put(System.currentTimeMillis() - start3);
                logger.finer("setting lobkeyattribute=" + columnName + " - " + s3ObjectId);
                attsToPut.add(new ReplaceableAttribute(columnName, s3ObjectId, true));
            } else if (getter.getAnnotation(Enumerated.class) != null) {
                Enumerated enumerated = getter.getAnnotation(Enumerated.class);
                Class retType = getter.getReturnType();
                EnumType enumType = enumerated.value();
                String toSet = null;
                if (enumType == EnumType.STRING) {
                    toSet = ob.toString();
                } else { // ordinal
                    Object[] enumConstants = retType.getEnumConstants();
                    for (int i = 0; i < enumConstants.length; i++) {
                        Object enumConstant = enumConstants[i];
                        if (enumConstant.toString().equals(ob.toString())) {
                            toSet = Integer.toString(i);
                            break;
                        }
                    }
                }
                if (toSet == null) {
                    // should never happen
                    throw new PersistenceException("Enum value is null, couldn't find ordinal match: " + ob);
                }
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            }
            else if(getter.getAnnotation(Id.class) != null)
            {
              continue;
            }
            else {
                String toSet = ob != null ? em.padOrConvertIfRequired(ob) : "";
                // todo: throw an exception if this is going to exceed maximum size, suggest using @Lob
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            }
        }

        // Now finally send it for storage (If have attributes to add)
        long start2 = System.currentTimeMillis();
        long duration2;
        if (!attsToPut.isEmpty()) {       
            this.em.getSimpleDb().putAttributes(new PutAttributesRequest()
               .withDomainName(domainName)
               .withItemName(id)
               .withAttributes(attsToPut));
            duration2 = System.currentTimeMillis() - start2;
            if(logger.isLoggable(Level.FINE))logger.fine("putAttributes time=" + (duration2));
            em.statsAttsPut(attsToPut.size(), duration2);
        }

        /*
         Check for nulled attributes so we can send a delete call.
        Don't delete attributes if this is a new object
        AND don't delete atts if it's not dirty
        AND don't delete if no nulls were set (nulledField on LazyInterceptor)
        */
        if (interceptor != null) {
            if (interceptor.getNulledFields() != null && interceptor.getNulledFields().size() > 0) {
                List<Attribute> attsToDelete2 = new ArrayList<Attribute>();
                for (String s : interceptor.getNulledFields().keySet()) {
                    Method getter = ai.getGetter(s);
                    String columnName = NamingHelper.getColumnName(getter);
                    attsToDelete2.add(new Attribute(columnName, null));
                }
                start2 = System.currentTimeMillis();
                this.em.getSimpleDb().deleteAttributes(new DeleteAttributesRequest()
View Full Code Here

        String id = em.getId(o);
        if (id == null || id.isEmpty()) {
            newObject = true;
            id = UUID.randomUUID().toString();
            // System.out.println("new object, setting id");
            AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);
            em.setFieldValue(o.getClass(), o, ai.getIdMethod(), Collections.singleton(id));
        }
        em.cachePut(id, o);
        return id;
    }
View Full Code Here

    protected void persistOnly(Object o, String id) throws AmazonClientException, IllegalAccessException,
            InvocationTargetException, IOException {
        long start = System.currentTimeMillis();
        em.invokeEntityListener(o, newObject ? PrePersist.class : PreUpdate.class);
        AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);

        UpdateCondition expected = null;
        PersistentProperty versionField = null;
        Long nextVersion = -1L;

        String domainName;
        if (ai.getRootClass() != null) {
            domainName = em.getOrCreateDomain(ai.getRootClass());
        } else {
            domainName = em.getOrCreateDomain(o.getClass());
        }
        // Item item = DomainHelper.findItemById(this.em.getSimpleDb(),
        // domainName, id);
        // now set attributes
        List<ReplaceableAttribute> attsToPut = new ArrayList<ReplaceableAttribute>();
        List<Attribute> attsToDelete = new ArrayList<Attribute>();
        if (ai.getDiscriminatorValue() != null) {
            attsToPut.add(new ReplaceableAttribute(EntityManagerFactoryImpl.DTYPE, ai.getDiscriminatorValue(), true));
        }

        LazyInterceptor interceptor = null;
        if (o instanceof Factory) {
            Factory factory = (Factory) o;
            /*
             * for (Callback callback2 : factory.getCallbacks()) {
             * if(logger.isLoggable(Level.FINER)) logger.finer("callback=" +
             * callback2); if (callback2 instanceof LazyInterceptor) {
             * interceptor = (LazyInterceptor) callback2; } }
             */
            interceptor = (LazyInterceptor) factory.getCallback(0);
        }

        for (PersistentProperty field : ai.getPersistentProperties()) {
            Object ob = field.getProperty(o);

            String columnName = field.getColumnName();
            if (ob == null) {
                attsToDelete.add(new Attribute(columnName, null));
                continue;
            }
            if (field.isForeignKeyRelationship()) {
                // store the id of this object
                if (Collection.class.isAssignableFrom(field.getRawClass())) {
                    for (Object each : (Collection) ob) {
                        String id2 = em.getId(each);
                        attsToPut.add(new ReplaceableAttribute(columnName, id2, true));
                    }
                } else {
                    String id2 = em.getId(ob);
                    attsToPut.add(new ReplaceableAttribute(columnName, id2, true));

                    /* check if we should persist this */
                    boolean persistRelationship = false;
                    ManyToOne a = field.getGetter().getAnnotation(ManyToOne.class);
                    if (a != null && null != a.cascade()) {
                        CascadeType[] cascadeType = a.cascade();
                        for (CascadeType type : cascadeType) {
                            if (CascadeType.ALL == type || CascadeType.PERSIST == type) {
                                persistRelationship = true;
                            }
                        }
                    }
                    if (persistRelationship) {
                        em.persist(ob);
                    }
                }
            } else if (field.isVersioned()) {
                Long curVersion = Long.parseLong("" + ob);
                nextVersion = (1 + curVersion);

                attsToPut.add(new ReplaceableAttribute(columnName, em.padOrConvertIfRequired(nextVersion), true));

                if (curVersion > 0) {
                    expected = new UpdateCondition(columnName, em.padOrConvertIfRequired(curVersion), true);
                } else {
                    expected = new UpdateCondition().withName(columnName).withExists(false);
                }

                versionField = field;
            } else if (field.isInverseRelationship()) {
                // FORCING BI-DIRECTIONAL RIGHT NOW SO JUST IGNORE
                // ... except for cascading persistence down to all items in the
                // OneToMany collection
                /* check if we should persist this */
                boolean persistRelationship = false;
                OneToMany a = field.getGetter().getAnnotation(OneToMany.class);
                CascadeType[] cascadeType = a.cascade();
                for (CascadeType type : cascadeType) {
                    if (CascadeType.ALL == type || CascadeType.PERSIST == type) {
                        persistRelationship = true;
                    }
                }
                if (persistRelationship) {
                    if (ob instanceof Collection) {
                        // it's OneToMany, so this should always be the case,
                        // shouldn't it?
                        for (Object _item : (Collection) ob) {
                            // persist each item in the collection
                            em.persist(_item);
                        }
                    }
                }

            } else if (field.isLob()) {
                // store in s3
                AmazonS3 s3 = null;
                // todo: need to make sure we only store to S3 if it's changed,
                // too slow.
                logger.fine("putting lob to s3");
                long start3 = System.currentTimeMillis();
                s3 = em.getS3Service();
                String bucketName = em.getS3BucketName();
                String s3ObjectId = id + "-" + field.getFieldName();

                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                ObjectOutputStream out = new ObjectOutputStream(bos);
                out.writeObject(ob);
                byte[] contentBytes = bos.toByteArray();
                out.close();
                InputStream input = new ByteArrayInputStream(contentBytes);

                s3.putObject(bucketName, s3ObjectId, input, null);

                em.statsS3Put(System.currentTimeMillis() - start3);
                logger.finer("setting lobkeyattribute=" + columnName + " - " + s3ObjectId);
                attsToPut.add(new ReplaceableAttribute(columnName, s3ObjectId, true));
            } else if (field.getEnumType() != null) {
                String toSet = getEnumValue(field, o);
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            } else if (field.isId()) {
                continue;
            } else if (Collection.class.isInstance(ob)) {
                for (Object each : ((Collection) ob)) {
                    String toSet = each != null ? em.padOrConvertIfRequired(each) : "";
                    // todo: throw an exception if this is going to exceed
                    // maximum size, suggest using @Lob
                    attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
                }
            } else {
                String toSet = ob != null ? em.padOrConvertIfRequired(ob) : "";
                // todo: throw an exception if this is going to exceed maximum
                // size, suggest using @Lob
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            }
        }

        // Now finally send it for storage (If have attributes to add)
        long start2 = System.currentTimeMillis();
        long duration2;
        if (!attsToPut.isEmpty()) {
            this.em.getSimpleDb().putAttributes(
                    new PutAttributesRequest().withDomainName(domainName).withItemName(id).withAttributes(attsToPut)
                            .withExpected(expected));
            duration2 = System.currentTimeMillis() - start2;
            if (logger.isLoggable(Level.FINE))
                logger.fine("putAttributes time=" + (duration2));
            em.statsAttsPut(attsToPut.size(), duration2);

            if (null != versionField)
                versionField.setProperty(o, nextVersion);
        }

        /*
         * Check for nulled attributes so we can send a delete call. Don't
         * delete attributes if this is a new object AND don't delete atts if
         * it's not dirty AND don't delete if no nulls were set (nulledField on
         * LazyInterceptor)
         */
        if (interceptor != null) {
            if (interceptor.getNulledFields() != null && interceptor.getNulledFields().size() > 0) {
                List<Attribute> attsToDelete2 = new ArrayList<Attribute>();
                for (String s : interceptor.getNulledFields().keySet()) {
                    String columnName = ai.getPersistentProperty(s).getColumnName();
                    attsToDelete2.add(new Attribute(columnName, null));
                }
                start2 = System.currentTimeMillis();
                this.em.getSimpleDb().deleteAttributes(
                        new DeleteAttributesRequest().withDomainName(domainName).withItemName(id)
View Full Code Here

        String id = em.getId(o);
        if (id == null) {
            newObject = true;
            id = UUID.randomUUID().toString();
            // System.out.println("new object, setting id");
            AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);
            em.setFieldValue(o.getClass(), o, ai.getIdMethod(), Collections.singleton(id));
        }
        em.cachePut(id, o);
        return id;
    }
View Full Code Here

    protected void persistOnly(Object o, String id) throws AmazonClientException, IllegalAccessException,
            InvocationTargetException, IOException {
        long start = System.currentTimeMillis();
        em.invokeEntityListener(o, newObject ? PrePersist.class : PreUpdate.class);
        AnnotationInfo ai = em.getFactory().getAnnotationManager().getAnnotationInfo(o);

        UpdateCondition expected = null;
        PersistentProperty versionField = null;
        Integer nextVersion = -1;

        String domainName;
        if (ai.getRootClass() != null) {
            domainName = em.getOrCreateDomain(ai.getRootClass());
        } else {
            domainName = em.getOrCreateDomain(o.getClass());
        }
        // Item item = DomainHelper.findItemById(this.em.getSimpleDb(),
        // domainName, id);
        // now set attributes
        List<ReplaceableAttribute> attsToPut = new ArrayList<ReplaceableAttribute>();
        List<Attribute> attsToDelete = new ArrayList<Attribute>();
        if (ai.getDiscriminatorValue() != null) {
            attsToPut.add(new ReplaceableAttribute(EntityManagerFactoryImpl.DTYPE, ai.getDiscriminatorValue(), true));
        }

        LazyInterceptor interceptor = null;
        if (o instanceof Factory) {
            Factory factory = (Factory) o;
            /*
             * for (Callback callback2 : factory.getCallbacks()) {
             * if(logger.isLoggable(Level.FINER)) logger.finer("callback=" +
             * callback2); if (callback2 instanceof LazyInterceptor) {
             * interceptor = (LazyInterceptor) callback2; } }
             */
            interceptor = (LazyInterceptor) factory.getCallback(0);
        }

        for (PersistentProperty field : ai.getPersistentProperties()) {
            Object ob = field.getProperty(o);

            String columnName = field.getColumnName();
            if (ob == null) {
                attsToDelete.add(new Attribute(columnName, null));
                continue;
            }
            if (field.isForeignKeyRelationship()) {
                // store the id of this object
                if (Collection.class.isAssignableFrom(field.getRawClass())) {
                    for (Object each : (Collection) ob) {
                        String id2 = em.getId(each);
                        attsToPut.add(new ReplaceableAttribute(columnName, id2, true));
                    }
                } else {
                    String id2 = em.getId(ob);
                    attsToPut.add(new ReplaceableAttribute(columnName, id2, true));

                    /* check if we should persist this */
                    boolean persistRelationship = false;
                    ManyToOne a = field.getGetter().getAnnotation(ManyToOne.class);
                    if (a != null && null != a.cascade()) {
                        CascadeType[] cascadeType = a.cascade();
                        for (CascadeType type : cascadeType) {
                            if (CascadeType.ALL == type || CascadeType.PERSIST == type) {
                                persistRelationship = true;
                            }
                        }
                    }
                    if (persistRelationship) {
                        em.persist(ob);
                    }
                }
            } else if (field.isVersioned()) {
                Integer curVersion = Integer.parseInt("" + ob);
                nextVersion = (1 + curVersion);

                attsToPut.add(new ReplaceableAttribute(columnName, em.padOrConvertIfRequired(nextVersion), true));

                if (curVersion > 0)
                    expected = new UpdateCondition(columnName, em.padOrConvertIfRequired(curVersion), true);

                versionField = field;
            } else if (field.isInverseRelationship()) {
                // FORCING BI-DIRECTIONAL RIGHT NOW SO JUST IGNORE
                // ... except for cascading persistence down to all items in the
                // OneToMany collection
                /* check if we should persist this */
                boolean persistRelationship = false;
                OneToMany a = field.getGetter().getAnnotation(OneToMany.class);
                CascadeType[] cascadeType = a.cascade();
                for (CascadeType type : cascadeType) {
                    if (CascadeType.ALL == type || CascadeType.PERSIST == type) {
                        persistRelationship = true;
                    }
                }
                if (persistRelationship) {
                    if (ob instanceof Collection) {
                        // it's OneToMany, so this should always be the case,
                        // shouldn't it?
                        for (Object _item : (Collection) ob) {
                            // persist each item in the collection
                            em.persist(_item);
                        }
                    }
                }
            } else if (field.isJsonLob()) {
                AmazonS3 s3 = em.getS3Service();

                long start3 = System.currentTimeMillis();
                String bucketName = em.getS3BucketName();
                String classRef = ai.getRootClass().getName().replace('.', '/');
                long lobTimestamp = System.currentTimeMillis() / 1000;
                String s3ObjectId = String.format("%s/%s/%08X.json", classRef, id + "-" + field.getFieldName(),
                        lobTimestamp);

                byte[] contentBytes = getJsonPayload(ob);

                InputStream input = new ByteArrayInputStream(contentBytes);

                s3.putObject(bucketName, s3ObjectId, input, null);

                em.statsS3Put(System.currentTimeMillis() - start3);
                logger.finer("setting lobkeyattribute=" + columnName + " - " + s3ObjectId);
                attsToPut.add(new ReplaceableAttribute(columnName, s3ObjectId, true));
            } else if (field.isLob()) {
                // store in s3
                AmazonS3 s3 = null;
                // todo: need to make sure we only store to S3 if it's changed,
                // too slow.
                logger.fine("putting lob to s3");
                long start3 = System.currentTimeMillis();
                s3 = em.getS3Service();
                String bucketName = em.getS3BucketName();
                String s3ObjectId = id + "-" + field.getFieldName();

                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                ObjectOutputStream out = new ObjectOutputStream(bos);
                out.writeObject(ob);
                byte[] contentBytes = bos.toByteArray();
                out.close();
                InputStream input = new ByteArrayInputStream(contentBytes);

                s3.putObject(bucketName, s3ObjectId, input, null);

                em.statsS3Put(System.currentTimeMillis() - start3);
                logger.finer("setting lobkeyattribute=" + columnName + " - " + s3ObjectId);
                attsToPut.add(new ReplaceableAttribute(columnName, s3ObjectId, true));
            } else if (field.getEnumType() != null) {
                String toSet = getEnumValue(field, o);
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            } else if (field.isId()) {
                continue;
            } else if (Collection.class.isInstance(ob)) {
                for (Object each : ((Collection) ob)) {
                    String toSet = each != null ? em.padOrConvertIfRequired(each) : "";
                    // todo: throw an exception if this is going to exceed
                    // maximum size, suggest using @Lob
                    attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
                }
            } else {
                String toSet = ob != null ? em.padOrConvertIfRequired(ob) : "";
                // todo: throw an exception if this is going to exceed maximum
                // size, suggest using @Lob
                attsToPut.add(new ReplaceableAttribute(columnName, toSet, true));
            }
        }

        // Now finally send it for storage (If have attributes to add)
        long start2 = System.currentTimeMillis();
        long duration2;
        if (!attsToPut.isEmpty()) {
            this.em.getSimpleDb().putAttributes(
                    new PutAttributesRequest().withDomainName(domainName).withItemName(id).withAttributes(attsToPut)
                            .withExpected(expected));
            duration2 = System.currentTimeMillis() - start2;
            if (logger.isLoggable(Level.FINE))
                logger.fine("putAttributes time=" + (duration2));
            em.statsAttsPut(attsToPut.size(), duration2);

            if (null != versionField)
                versionField.setProperty(o, nextVersion);
        }

        /*
         * Check for nulled attributes so we can send a delete call. Don't
         * delete attributes if this is a new object AND don't delete atts if
         * it's not dirty AND don't delete if no nulls were set (nulledField on
         * LazyInterceptor)
         */
        if (interceptor != null) {
            if (interceptor.getNulledFields() != null && interceptor.getNulledFields().size() > 0) {
                List<Attribute> attsToDelete2 = new ArrayList<Attribute>();
                for (String s : interceptor.getNulledFields().keySet()) {
                    String columnName = ai.getPersistentProperty(s).getColumnName();
                    attsToDelete2.add(new Attribute(columnName, null));
                }
                start2 = System.currentTimeMillis();
                this.em.getSimpleDb().deleteAttributes(
                        new DeleteAttributesRequest().withDomainName(domainName).withItemName(id)
View Full Code Here

TOP

Related Classes of com.spaceprogram.simplejpa.AnnotationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.