Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Examples/DBWS/DBWSIntermediateIgnoreColumn"
< EclipseLink | Examples | DBWS
Line 1: | Line 1: | ||
+ | <css> | ||
+ | .source-java5 {border-style: solid; background-color: white;} | ||
+ | </css> | ||
== Skip a database column so that is does not show up in generated schema == | == Skip a database column so that is does not show up in generated schema == | ||
As seen in the previous [[../DBWSIntermediateAttribute|Intermediate example]], a user can provide a custom <code>NamingConventionTransformer</code>. | As seen in the previous [[../DBWSIntermediateAttribute|Intermediate example]], a user can provide a custom <code>NamingConventionTransformer</code>. | ||
Line 5: | Line 8: | ||
* make the element names lowercase | * make the element names lowercase | ||
* skip the <tt>SINCE</tt> field | * skip the <tt>SINCE</tt> field | ||
− | <source lang=java5 | + | <source lang=java5> |
package foo.bar.blah; | package foo.bar.blah; | ||
Revision as of 13:58, 3 June 2009
Skip a database column so that is does not show up in generated schema
As seen in the previous Intermediate example, a user can provide a custom NamingConventionTransformer
.
The following NamingConventionTransformer
will:
- name the schema element 'simple'
- make the element names lowercase
- skip the SINCE field
package foo.bar.blah; import org.eclipse.persistence.tools.dbws.DefaultNamingConventionTransformer; import static org.eclipse.persistence.tools.dbws.NamingConventionTransformer.ElementStyle.ELEMENT; import static org.eclipse.persistence.tools.dbws.NamingConventionTransformer.ElementStyle.NONE; public class MyNamingConventionTransformer extends DefaultNamingConventionTransformer { @Override public String generateSchemaAlias(String tableName) { return super.generateSchemaAlias("simple"); } @Override public String generateElementAlias(String originalElementName) { return super.generateElementAlias(originalElementName.toLowerCase()); } @Override public ElementStyle styleForElement(String elementName) { if ("since".equalsIgnoreCase(elementName)) { return NONE; } return ELEMENT; } }