openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chathuri Wimalasena <kamalas...@gmail.com>
Subject Mapping table names with model names
Date Mon, 03 Feb 2014 17:54:41 GMT
Hi Devs,

I have database table names as APPLICATION_DESCRIPTOR, EXPERIMENT_SUMMARY
etc. I'm using openJPA to map this tables to object model.

In the model class, I annotate each class with table name as below.

@Entity
@IdClass(Application_Descriptor_PK.class)
@Table(name ="APPLICATION_DESCRIPTOR")
public class Application_Descriptor {

}

When I build my project using maven, I'm getting following exception.

main:
147  airavata_data  INFO   [main] openjpa.Tool - Enhancer running on type
"org.apache.airavata.persistance.registry.jpa.model.Application_Descriptor".
java.lang.IllegalArgumentException: java.lang.ClassNotFoundException:
org.apache.airavata.persistance.registry.jpa.model.Application_Descriptor
at serp.util.Strings.toClass(Strings.java:164)
 at serp.util.Strings.toClass(Strings.java:108)
at serp.bytecode.BCClass.getType(BCClass.java:566)
at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:286)
 at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4797)
at org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)
 at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
 at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
 at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
 at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:270)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
 at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
 at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
 at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
 at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
 at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
 at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

I'm specifying model classes in my persistence.xml as below.

<persistence-unit name="airavata_data">

<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

<class>org.apache.airavata.persistance.registry.jpa.model.Gateway</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Configuration</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Users</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Project</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Published_Workflow</class>

<class>org.apache.airavata.persistance.registry.jpa.model.User_Workflow</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Service_Descriptor</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Application_Descriptor</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Configuration_Data</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Summary</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Input</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Output</class>

<class>org.apache.airavata.persistance.registry.jpa.model.Workflow_Data</class>
 <class>org.apache.airavata.persistance.registry.jpa.model.Node_Data</class>
<!--<class>org.apache.airavata.persistance.registry.jpa.model.Gram_Data</class>-->

<class>org.apache.airavata.persistance.registry.jpa.model.Execution_Error</class>
<class>org.apache.airavata.persistance.registry.jpa.model.GFac_Job_Data</class>

<class>org.apache.airavata.persistance.registry.jpa.model.GFac_Job_Status</class>
<class>org.apache.airavata.persistance.registry.jpa.model.Orchestrator</class>
</persistence-unit>

Also I added maven-antrun-plugin in my pom.xml as well.

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${antrun.version}</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <configuration>
                            <tasks>
                                <taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask"
classpathref="maven.compile.classpath" />
                                <openjpac>
                                    <classpath
refid="maven.compile.classpath" />
                                </openjpac>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Any idea why I'm getting this error and how can I get rid of that.

Thanks and Regards,
Chathuri

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message