Examples of DatabaseField


Examples of com.reflectiondao.annotation.DatabaseField

    try {

      List<Object> params = new ArrayList<Object>();

      for (Field f : this.type.getDeclaredFields()) {
        DatabaseField db = f.getAnnotation(DatabaseField.class);

        params.add(db.type().getValue(f, rs));

      }

      @SuppressWarnings("unchecked")
      Constructor<S> ctor = (Constructor<S>) this.type.getConstructors()[0];
View Full Code Here

Examples of de.zalando.typemapper.annotations.DatabaseField

    }

    public static final Object mapFromDbObjectNode(final Class classz, final ObjectResultNode node,
            final Mapping mapping) throws InstantiationException, IllegalAccessException, IllegalArgumentException,
        InvocationTargetException, NotsupportedTypeException {
        DatabaseField databaseField = mapping.getField().getAnnotation(DatabaseField.class);
        final Object value;

        if (mapping.isOptionalField() && isRowWithAllFieldsNull(node)) {
            value = null;
        } else if (databaseField.mapper() != DefaultObjectMapper.class) {
            ObjectMapper mapper = databaseField.mapper().newInstance();
            value = mapper.unmarshalFromDbNode(node);
        } else {
            value = mapField(mapping.getFieldClass(), node);
        }
View Full Code Here

Examples of oracle.toplink.essentials.internal.helper.DatabaseField

            tblDef = getTableDefFromDBTable(dbTbl);
        }

        //build each field definition and figure out which table it goes
        Iterator fieldIter = desc.getFields().iterator();
        DatabaseField dbField = null;

        while (fieldIter.hasNext()) {
            dbField = (DatabaseField) fieldIter.next();

            boolean isPKField = false;

            //first check if the filed is a pk field in the default table.
            isPKField = desc.getPrimaryKeyFields().contains(dbField);

            //then check if the field is a pk field in the secondary table(s), this is only applied to the multiple tables case.
            Map secondaryKeyMap = (Map) desc.getAdditionalTablePrimaryKeyFields().get(dbField.getTable());

            if (secondaryKeyMap != null) {
                isPKField = isPKField || secondaryKeyMap.containsValue(dbField);
            }

            //build or retrieve the field definition.
            FieldDefinition fieldDef = getFieldDefFromDBField(dbField, isPKField);
            if (isPKField) {
                // Check if the generation strategy is IDENTITY
                String sequenceName = desc.getSequenceNumberName();
                DatabaseLogin login = project.getLogin();
                Sequence seq = login.getSequence(sequenceName);
                if(seq instanceof DefaultSequence) {
                    seq = login.getDefaultSequence();
                }
                //The native sequence whose value should be aquired after insert is identity sequence
                boolean isIdentity = seq instanceof NativeSequence && seq.shouldAcquireValueAfterInsert();
                fieldDef.setIsIdentity(isIdentity);
            }

            //find the table the field belongs to, and add it to the table, ony if not already added.
            tblDef = tableMap.get(dbField.getTableName());

            if (!tblDef.getFields().contains(fieldDef)) {
                tblDef.addField(fieldDef);
            }
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

            writer.write("BEGIN ");
            writer.write(sqlCall.getSQLString());
            writer.write(" RETURNING ");

            for (int i = 0; i < returnFields.size(); i++) {
                DatabaseField field = (DatabaseField)returnFields.elementAt(i);
                writer.write(field.getNameDelimited(this));
                if ((i + 1) < returnFields.size()) {
                    writer.write(", ");
                }
            }

            writer.write(" INTO ");

            for (int i = 0; i < returnFields.size(); i++) {
                DatabaseField field = (DatabaseField)returnFields.elementAt(i);
                call.appendOut(writer, field);
                if ((i + 1) < returnFields.size()) {
                    writer.write(", ");
                }
            }
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

            if(isFirst) {
                isFirst = false;
            } else {
                writer.write(", ");
            }
            DatabaseField field = (DatabaseField)itFields.next();
            String fieldName = field.getNameDelimited(this);
            writer.write(fieldName);
            writer.write(" = (SELECT ");
            writer.write(fieldName);
            writer.write(" FROM ");
            writer.write(tempTableName);
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

        // PERF: Direct variable access.
        // ** Code duplicated in get, ensure kept in synch **
        // Optimize check.
        int index = key.getIndex();
        if ((index >= 0) && (index < this.size)) {
            DatabaseField field = (DatabaseField)this.fields.get(index);
            if ((field == key) || field.equals(key)) {
                return this.values.get(index);
            }
        }
        index = this.fields.indexOf(key);
        if (index >= 0) {
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

     */
    public DatabaseField getField(DatabaseField key) {
        // Optimize check.
        int index = key.getIndex();
        if ((index >= 0) && (index < getFields().size())) {
            DatabaseField field = (DatabaseField)getFields().elementAt(index);
            if ((field == key) || field.equals(key)) {
                return field;
            }
        }
        for (index = 0; index < getFields().size(); index++) {
            DatabaseField field = (DatabaseField)getFields().elementAt(index);
            if ((field == key) || field.equals(key)) {
                return field;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

    /**
     * PUBLIC:
     * Add the field-value pair to the row.
     */
    public Object put(String key, Object value) {
        return put(new DatabaseField(key), value);
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

    /**
     * INTERNAL:
     * Remove the field key from the row.
     */
    public Object remove(String fieldName) {
        return remove(new DatabaseField(fieldName));
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.helper.DatabaseField

     * Check if the field is contained in the row.
     */
    public boolean containsKey(String fieldName) {
        // Optimized the field creation.
        if (this.lookupField == null) {
            this.lookupField = new DatabaseField(fieldName);
        } else {
            this.lookupField.resetQualifiedName(fieldName);
        }
        return containsKey(this.lookupField);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.