diff options
author | Eike Stepper | 2013-05-29 07:22:20 +0000 |
---|---|---|
committer | Eike Stepper | 2013-05-29 07:52:11 +0000 |
commit | 5ce7219182441088fbcdda476c58d3efd04aec03 (patch) | |
tree | 3c0ab3d872521474343f70294c53d653f7b062dc /plugins/org.eclipse.emf.cdo.server.db | |
parent | 1c67bb211f590b914809556206b1622a0e7ff5f2 (diff) | |
download | cdo-5ce7219182441088fbcdda476c58d3efd04aec03.tar.gz cdo-5ce7219182441088fbcdda476c58d3efd04aec03.tar.xz cdo-5ce7219182441088fbcdda476c58d3efd04aec03.zip |
[396743] [DB] List size column mismatching the row entries
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396743
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java index 7dddc0aa6c..b3a4b34e9f 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/AbstractTypeMapping.java @@ -36,6 +36,7 @@ import org.eclipse.emf.ecore.EStructuralFeature; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.MessageFormat; /** * This is a default implementation for the {@link ITypeMapping} interface which provides default behavor for all common @@ -58,10 +59,10 @@ public abstract class AbstractTypeMapping implements ITypeMapping private EStructuralFeature feature; - private IDBField field; - private DBType dbType; + private IDBField field; + /** * Create a new type mapping */ @@ -69,14 +70,19 @@ public abstract class AbstractTypeMapping implements ITypeMapping { } + public final IMappingStrategy getMappingStrategy() + { + return mappingStrategy; + } + public final void setMappingStrategy(IMappingStrategy mappingStrategy) { this.mappingStrategy = mappingStrategy; } - public final IMappingStrategy getMappingStrategy() + public final EStructuralFeature getFeature() { - return mappingStrategy; + return feature; } public final void setFeature(EStructuralFeature feature) @@ -84,9 +90,14 @@ public abstract class AbstractTypeMapping implements ITypeMapping this.feature = feature; } - public final EStructuralFeature getFeature() + public final void setDBType(DBType dbType) { - return feature; + this.dbType = dbType; + } + + public DBType getDBType() + { + return dbType; } public final void setValueFromRevision(PreparedStatement stmt, int index, InternalCDORevision revision) @@ -151,14 +162,14 @@ public abstract class AbstractTypeMapping implements ITypeMapping field = table.addField(fieldName, fieldType, fieldLength); } - public final void setDBField(IDBTable table, String fieldName) + public final IDBField getField() { - field = table.getFieldSafe(fieldName); + return field; } - public final IDBField getField() + public final void setDBField(IDBTable table, String fieldName) { - return field; + field = table.getFieldSafe(fieldName); } public final void readValueToRevision(ResultSet resultSet, InternalCDORevision revision) throws SQLException @@ -208,6 +219,15 @@ public abstract class AbstractTypeMapping implements ITypeMapping return value; } + @Override + public String toString() + { + Object mappedElement = field != null ? field : dbType; + return MessageFormat + .format( + "{0}[{1}.{2} --> {3}]", getClass().getSimpleName(), feature.getEContainingClass().getName(), feature.getName(), mappedElement); //$NON-NLS-1$ + } + protected Object getDefaultValue() { return feature.getDefaultValue(); @@ -245,16 +265,6 @@ public abstract class AbstractTypeMapping implements ITypeMapping return getDBType().getCode(); } - public final void setDBType(DBType dbType) - { - this.dbType = dbType; - } - - public DBType getDBType() - { - return dbType; - } - protected int getDBLength(DBType type) { String value = DBAnnotation.COLUMN_LENGTH.getValue(feature); |