You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by RamAESIS <rs...@hcl.in> on 2009/02/23 10:00:42 UTC
Regarding field names of persistent classes generated
Hi,
I am using the reverse mapping tool to generate classes from my tables. The
tool by default changes the names of the DB fields by removing the
underscores and changing the the case of subsequent character
e.g. field name in DB ==== OB_AO_PD_VRS
is changed to ===== ObAoPdVrs
how to avoid this and force the tool to have the available name in database,
i browsed through the customization section of Reverse Mapping tool but
could not find a property. Any help is highly appreciated
Regards,
Ram
--
View this message in context: http://n2.nabble.com/Regarding-field-names-of-persistent-classes-generated-tp2371154p2371154.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Re: Regarding field names of persistent classes generated
Posted by RamAESIS <rs...@hcl.in>.
Hi,
I wrote a custom class extending the default PropertiesReverseCustomizer and
over rid the 2 methods as mentioned below:
@Override
public String getClassName(Table table, String defaultName) {
// TODO Auto-generated method stub
if(defaultName.indexOf('.') > -1)
return defaultName.substring(0,
defaultName.lastIndexOf('.')+1)+table.getName();
else
return table.getName();
}
@Override
public String getFieldName(ClassMapping dec, Column[] cols, ForeignKey fk,
String defaultName) {
// TODO Auto-generated method stub
return cols[0].getName();
}
This works fine for me, please let me know whether this will cause any
undesired effects as i am not sure whether this is the proper solution.
Regards,
Ram
RamAESIS wrote:
>
> Hi,
>
> I am using the reverse mapping tool to generate classes from my tables.
> The tool by default changes the names of the DB fields by removing the
> underscores and changing the the case of subsequent character
> e.g. field name in DB ==== OB_AO_PD_VRS
>
> is changed to ===== ObAoPdVrs
>
> how to avoid this and force the tool to have the available name in
> database, i browsed through the customization section of Reverse Mapping
> tool but could not find a property. Any help is highly appreciated
>
> Regards,
> Ram
>
--
View this message in context: http://n2.nabble.com/Regarding-field-names-of-persistent-classes-generated-tp2371154p2372160.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.