/** * 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); }