Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2013-11-17 22:21:16 +0000
committerMartin Taal2013-11-17 22:21:16 +0000
commit8ed2c2ccc76793e02a1cc9eea80b23eea6282eab (patch)
treee2f83b8a628e43d8a0a3f5e718f93b6ba0f865aa /hibernate
parent6670b44e161638fe7ad59ddd3b2b7889494048d3 (diff)
downloadorg.eclipse.emf.teneo-8ed2c2ccc76793e02a1cc9eea80b23eea6282eab.tar.gz
org.eclipse.emf.teneo-8ed2c2ccc76793e02a1cc9eea80b23eea6282eab.tar.xz
org.eclipse.emf.teneo-8ed2c2ccc76793e02a1cc9eea80b23eea6282eab.zip
[420463] - implement columnDefinition handling for DiscriminatorColumn annotation
Diffstat (limited to 'hibernate')
-rwxr-xr-xhibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java
index 8c81e03e9..1d7eef7dd 100755
--- a/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java
+++ b/hibernate/org.eclipse.emf.teneo.hibernate.mapper/src/org/eclipse/emf/teneo/hibernate/mapper/EntityMapper.java
@@ -697,6 +697,9 @@ public class EntityMapper extends AbstractMapper implements ExtensionPoint {
if (!col.isNullable()) {
colElement.addAttribute("not-null", "true");
}
+ if (col.getColumnDefinition() != null) {
+ colElement.addAttribute("sql-type", col.getColumnDefinition());
+ }
} else if (dColumn.getName() != null) {
dcElement.addAttribute("column", getHbmContext().trunc(dColumn, dColumn.getName()));
}
@@ -711,9 +714,17 @@ public class EntityMapper extends AbstractMapper implements ExtensionPoint {
}
if (dColumn.getColumnDefinition() != null) {
- log.error("Unsupported column definition in discriminator column " + dColumn);
- throw new MappingException("Unsupported column definition in discriminator column", dColumn);
+ String colName = dcElement.getAttributeValue("column");
+ Element colElement = dcElement.element("column");
+ if (colElement == null) {
+ colElement = dcElement.addElement("column");
+ if (colName != null && colElement.getAttributeValue("name") == null) {
+ colElement.addAttribute("name", colName);
+ }
+ }
+ colElement.addAttribute("sql-type", dColumn.getColumnDefinition());
}
+
return dcElement;
}

Back to the top