Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.MetaDataException


            cols.add(newColumn(joins[i]));
            unique |= (joins[i].unique()) ? TRUE : FALSE;
            secondary = trackSecondaryTable(fm, secondary,
                joins[i].table(), i);
            if (!secondaryAllowed && secondary != null)
                throw new MetaDataException(_loc.get("bad-second", fm));
        }

        setColumns(fm, info, cols, unique);
        if (secondary != null)
            fm.getMappingInfo().setTableName(secondary);
View Full Code Here


            cols.add(newColumn(joins[i]));
            unique |= (joins[i].unique()) ? TRUE : FALSE;
            secondary = trackSecondaryTable(fm, secondary,
                joins[i].table(), i);
            if (!secondaryAllowed && secondary != null)
                throw new MetaDataException(_loc.get("bad-second", fm));
        }

        setColumns(fm, info, cols, unique);
        if (secondary != null)
            fm.getMappingInfo().setTableName(secondary);
View Full Code Here

     * Parse embedded info for the given mapping.
     */
    private void parseEmbeddedMapping(FieldMapping fm, EmbeddedMapping anno) {
        ClassMapping embed = fm.getEmbeddedMapping();
        if (embed == null)
            throw new MetaDataException(_loc.get("not-embedded", fm));

        FieldMapping efm;
        for (MappingOverride over : anno.overrides()) {
            efm = embed.getFieldMapping(over.name());
            if (efm == null)
                throw new MetaDataException(_loc.get("embed-override-name",
                    fm, over.name()));
            populate(efm, over);
        }

        String nullInd = null;
View Full Code Here

            // it might have to switch to std application identity if pk field
            // not compatible
            if (cls.getPCSuperclass() == null
                && cls.getIdentityType() == ClassMapping.ID_APPLICATION) {
                if (cls.getPrimaryKeyFields().length == 0)
                    throw new MetaDataException(_loc.get("no-pk-fields", cls));
                if (cls.getObjectIdType() == null
                    || (cls.isOpenJPAIdentity() && !isBuiltinIdentity(cls)))
                    setObjectIdType(cls);
            } else if (cls.getIdentityType() == ClassMapping.ID_DATASTORE)
                cls.getPrimaryKeyColumns()[0].setJavaType(JavaTypes.LONG);
View Full Code Here

    private boolean _synthetic = false;

    public void map(boolean adapt) {
        if (field.getEmbeddedMetaData() == null)
            throw new MetaDataException(_loc.get("not-embed", field));
        assertNotMappedBy();

        // map join key (if any)
        field.mapJoin(adapt, false);
        field.getKeyMapping().getValueInfo().assertNoSchemaComponents
View Full Code Here

    private Column getEquivalentColumn(Column col, ClassMapping target,
        String fieldName) {
        fieldName = fieldName.substring(fieldName.indexOf('.') + 1);
        FieldMapping field = target.getFieldMapping(fieldName);
        if (field == null)
            throw new MetaDataException(_loc.get("no-equiv-field",
                new Object[]{ this, target, fieldName, col }));

        Column[] cols = field.getColumns();
        if (cols.length != 1)
            throw new MetaDataException(_loc.get("bad-equiv-field",
                new Object[]{ this, target, fieldName, col }));

        return cols[0];
    }
View Full Code Here

                if (ret != null)
                    return ret;
            }
        }

        throw new MetaDataException(_loc.get("no-equiv-col", this, target,
            colName));
    }
View Full Code Here

     */
    private ForeignKey newInverseForeignKey(ClassMapping target) {
        FieldMapping field = getFieldMapping();
        FieldMapping mapped = field.getMappedByMapping();
        if (mapped == null)
            throw new MetaDataException(_loc.get("cant-inverse", this));

        mapped = target.getFieldMapping(mapped.getIndex());
        if (mapped == null || mapped.getTypeCode() != JavaTypes.PC)
            throw new MetaDataException(_loc.get("no-equiv-mapped-by",
                this, target, field.getMappedBy()));
        return mapped.getForeignKey();
    }
View Full Code Here

            fmd.getElement().getEmbeddedMetaData() != null ||
            isDeferredEmbeddable(fmd.getElement().getDeclaredType(),
                fmd.getElement())) {
            if (dec.length() == 0 || dec.equals("ASC") ||
                dec.equals("DESC"))
                throw new MetaDataException(_loc.get(
                    "invalid-orderBy", fmd));
        }
        if (StringUtils.isEmpty(dec) || dec.equals("ASC"))
            dec = Order.ELEMENT + " asc";
        else if (dec.equals("DESC"))
View Full Code Here

                  }
                  addDeferredEmbeddableMetaData(classes[i],
                      access);
              }
              catch (Exception e) {
                  throw new MetaDataException(
                      _loc.get("no-embeddable-metadata",
                          classes[i].getName()), e);
              }
          }
      } 
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.MetaDataException

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.