Hello all, I am trying to customize the naming for the generated tables and columns. For example instead of creating a table "useraccossiation", which come from the camel case in
UserAssociation, I like to have a table "user_association". I understand this can be done with annotations on classes and fields or properties, but this is not what I want. Following this post http://stackoverflow.com/questions/5997051/openjpa-extending-persistencemappingdefaults-to-convert-camel-case-to-undersco I tried to do this in my persistence.xml <properties> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=TRACE, Runtime=TRACE, SQL=TRACE" /> <property name="openjpa.jdbc.MappingDefaults" value="org.example.CamelCase2UnderscoreMapper" /> </properties> The error I am getting: Caused by: org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "jdbc.MappingDefaults" with value "org.example.CamelCase2UnderscoreMapper" caused an error "java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.example.CamelCase2UnderscoreMapper". The alias or class name may have been misspelled, or the class may not have be available in the class path. Valid aliases for this plugin are: [default, ejb, jpa] at org.apache.openjpa.lib.conf.Configurations.getCreateException(Configurations.java:422) at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:222) at org.apache.openjpa.lib.conf.ObjectValue.newInstance(ObjectValue.java:124) at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:105) at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getMappingDefaultsInstance(JDBCConfigurationImpl.java:706) at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1520) at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:531) at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:456) at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:120) at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68) at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83) at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967) at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958) at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:644) at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203) ... 43 more Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.example.CamelCase2UnderscoreMapper at serp.util.Strings.toClass(Strings.java:164) at serp.util.Strings.toClass(Strings.java:108) at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:214) The class is located in the same bundle of persistence.xml and I tried to move it to another bundle, which is what I want, but nothing is working. I am not sure where to dig further. Could it be that when in the same bundle, it is not available on the classpath for the org.apache.openjpa.lib.conf.Configurations when it's being created ? What do I need to do to make this custom mapping class available on the classpath for the EMF ? Thank you for your time.
