Search in sources :

Example 1 with NoSuchPersistentFieldException

use of org.datanucleus.store.rdbms.exceptions.NoSuchPersistentFieldException in project datanucleus-rdbms by datanucleus.

the class ClassTable method getMemberMapping.

/**
 * Accessor for the field mapping for the named field.
 * The field may exist in a parent table or a secondary table.
 * Throws a NoSuchPersistentFieldException if the field name is not found.
 * TODO Use of this is discouraged since the fieldName is not fully qualified
 * and if a superclass-table inheritance is used we could have 2 fields of that name here.
 * @param memberName Name of field/property
 * @return The mapping.
 * @throws NoSuchPersistentFieldException Thrown when the field/property is not found
 */
public JavaTypeMapping getMemberMapping(String memberName) {
    assertIsInitialized();
    AbstractMemberMetaData mmd = getMetaDataForMember(memberName);
    JavaTypeMapping m = getMemberMapping(mmd);
    if (m == null) {
        throw new NoSuchPersistentFieldException(cmd.getFullClassName(), memberName);
    }
    return m;
}
Also used : JavaTypeMapping(org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping) NoSuchPersistentFieldException(org.datanucleus.store.rdbms.exceptions.NoSuchPersistentFieldException) AbstractMemberMetaData(org.datanucleus.metadata.AbstractMemberMetaData)

Example 2 with NoSuchPersistentFieldException

use of org.datanucleus.store.rdbms.exceptions.NoSuchPersistentFieldException in project datanucleus-rdbms by datanucleus.

the class ClassView method getMemberMapping.

/**
 * Accessor for the mapping for the specified field/property.
 * @param mmd Metadata for the field/property
 * @return The Mapping for the field.
 */
public JavaTypeMapping getMemberMapping(AbstractMemberMetaData mmd) {
    assertIsInitialized();
    JavaTypeMapping m = fieldMappings[mmd.getAbsoluteFieldNumber()];
    if (m == null) {
        throw new NoSuchPersistentFieldException(cmd.getFullClassName(), mmd.getAbsoluteFieldNumber());
    }
    return m;
}
Also used : JavaTypeMapping(org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping) NoSuchPersistentFieldException(org.datanucleus.store.rdbms.exceptions.NoSuchPersistentFieldException)

Aggregations

NoSuchPersistentFieldException (org.datanucleus.store.rdbms.exceptions.NoSuchPersistentFieldException)2 JavaTypeMapping (org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping)2 AbstractMemberMetaData (org.datanucleus.metadata.AbstractMemberMetaData)1