org.sandev.generator
Class PostgreSQLStructMapper
java.lang.Object
org.sandev.generator.DefaultSQLStructMapper
org.sandev.generator.PostgreSQLStructMapper
- All Implemented Interfaces:
- StructMapper
public class PostgreSQLStructMapper
- extends DefaultSQLStructMapper
- implements StructMapper
A StructMapper for PostgreSQL database tables. This addresses the following
issues that make PostgreSQL different from the DefaultSQLStructMapper:
- SELECT TOP N is not supported, and LIMIT is supported only at the
end of a query. The JDBC persistence generators pick up on this
instance to generate appropriate query support.
Rather than reimplementing methods that are the same, this class
extends the default.
|
Method Summary |
java.lang.String |
getMappedFieldName(com.sun.javadoc.ClassDoc struct,
com.sun.javadoc.FieldDoc field)
PostgreSQL prevents some reserved words from being used as column names
unless they're quoted. |
java.lang.String |
getMappedFieldType(com.sun.javadoc.ClassDoc struct,
com.sun.javadoc.FieldDoc field)
Field overrides for PostgreSQL. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PostgreSQLStructMapper
public PostgreSQLStructMapper()
getMappedFieldName
public java.lang.String getMappedFieldName(com.sun.javadoc.ClassDoc struct,
com.sun.javadoc.FieldDoc field)
- PostgreSQL prevents some reserved words from being used as column names
unless they're quoted. Quoting doesn't fit well with the existing SQL
generators, so append "_ref" to the field name.
- Specified by:
getMappedFieldName in interface StructMapper- Overrides:
getMappedFieldName in class DefaultSQLStructMapper
getMappedFieldType
public java.lang.String getMappedFieldType(com.sun.javadoc.ClassDoc struct,
com.sun.javadoc.FieldDoc field)
- Field overrides for PostgreSQL. PostgreSQL doesn't like "double"
and insists on "double precision" instead.
- Specified by:
getMappedFieldType in interface StructMapper- Overrides:
getMappedFieldType in class DefaultSQLStructMapper