/** * PUBLIC: * Add a direct to field mapping to the receiver. The new mapping specifies that * an instance variable of the class of objects which the receiver describes maps in * the default manner for its type to the indicated database field. * * @param attributeName is the name of an instance variable of the * class which the receiver describes. * @param fieldName is the name of the database column which corresponds * with the designated instance variable. * @return The newly created DatabaseMapping is returned. */ public DatabaseMapping addDirectMapping(String attributeName, String fieldName) { DirectToFieldMapping mapping = new DirectToFieldMapping(); mapping.setAttributeName(attributeName); mapping.setFieldName(fieldName); return addMapping(mapping); }
/** * Allows {@link DirectToFieldMapping} (@Basic) mapping to be added to a * dynamic type through API. This method can be used on a new * {@link DynamicTypeImpl} that has yet to be added to a session and have * its descriptor initialized, or it can be called on an active * (initialized) descriptor. * <p> * There is no support currently for having the EclipseLink * {@link SchemaManager} generate ALTER TABLE calls so any new columns * expected must be added without the help of EclipseLink or use the * {@link SchemaManager#replaceObject(org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition)} * to DROP and CREATE the table. WARNING: This will cause data loss. * * @param javaType * is the type of the attribute. If the type is a primitive it * will be converted to the comparable non-primitive type. */ public DirectToFieldMapping addDirectMapping(String name, Class<?> javaType, String fieldName) { DirectToFieldMapping mapping = new DirectToFieldMapping(); mapping.setAttributeName(name); mapping.setFieldName(fieldName); mapping.setAttributeClassification(javaType); return (DirectToFieldMapping) addMapping(mapping); }
/** * Allows {@link DirectToFieldMapping} (@Basic) mapping to be added to a * dynamic type through API. This method can be used on a new * {@link DynamicTypeImpl} that has yet to be added to a session and have * its descriptor initialized, or it can be called on an active * (initialized) descriptor. * <p> * There is no support currently for having the EclipseLink * {@link SchemaManager} generate ALTER TABLE calls so any new columns * expected must be added without the help of EclipseLink or use the * {@link SchemaManager#replaceObject(org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition)} * to DROP and CREATE the table. WARNING: This will cause data loss. * * @param javaType * is the type of the attribute. If the type is a primitive it * will be converted to the comparable non-primitive type. */ public DirectToFieldMapping addDirectMapping(String name, Class<?> javaType, String fieldName) { DirectToFieldMapping mapping = new DirectToFieldMapping(); mapping.setAttributeName(name); mapping.setFieldName(fieldName); mapping.setAttributeClassification(javaType); return (DirectToFieldMapping) addMapping(mapping); }
/** * Allows {@link DirectToFieldMapping} (@Basic) mapping to be added to a * dynamic type through API. This method can be used on a new * {@link DynamicTypeImpl} that has yet to be added to a session and have * its descriptor initialized, or it can be called on an active * (initialized) descriptor. * <p> * There is no support currently for having the EclipseLink * {@link SchemaManager} generate ALTER TABLE calls so any new columns * expected must be added without the help of EclipseLink or use the * {@link SchemaManager#replaceObject(org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition)} * to DROP and CREATE the table. WARNING: This will cause data loss. * * @param javaType * is the type of the attribute. If the type is a primitive it * will be converted to the comparable non-primitive type. */ public DirectToFieldMapping addDirectMapping(String name, Class<?> javaType, String fieldName) { DirectToFieldMapping mapping = new DirectToFieldMapping(); mapping.setAttributeName(name); mapping.setFieldName(fieldName); mapping.setAttributeClassification(javaType); return (DirectToFieldMapping) addMapping(mapping); }
/** * PUBLIC: * Add a direct to field mapping to the receiver. The new mapping specifies that * a variable accessed by the get and set methods of the class of objects which * the receiver describes maps in the default manner for its type to the indicated * database field. */ public DatabaseMapping addDirectMapping(String attributeName, String getMethodName, String setMethodName, String fieldName) { DirectToFieldMapping mapping = new DirectToFieldMapping(); mapping.setAttributeName(attributeName); mapping.setSetMethodName(setMethodName); mapping.setGetMethodName(getMethodName); mapping.setFieldName(fieldName); return addMapping(mapping); }