openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Makas Tzavellas <duckni...@gmail.com>
Subject Re: Using ant task mappingtool to generate tables
Date Tue, 26 Jun 2007 05:25:30 GMT
Hi Pinaki,

Thank you for your response. I am running the ant task from maven's ant 
plugin. Here is the following snippet
<mappingtool action="buildSchema" sqlFile="test.sql">
  <classpath>
    <path refid="maven.runtime.classpath"/>
  </classpath>
  <fileset dir="${project.build.sourceDirectory}/">
    <include name="**/data/*.java"/>
  </fileset>
</mappingtool>

Here's the log and stacktrace of the error
[INFO] Executing tasks
16  subway  TRACE  [main] openjpa.Runtime - Setting the following 
properties from 
"file:/C:/dev/softbrands/broker/subway/db/target/classes/META-INF/persistence.xml" 
into configuration: {openjpa.ConnectionUserName=sa, 
openjpa.ConnectionPassword=, openjpa.Log=DefaultLevel=TRACE, Tool=INFO, 
openjpa.ConnectionURL=jdbc:derby:subway-test;create=true, 
openjpa.ConnectionDriverName=org.apache.derby.jdbc.EmbeddedDriver, 
openjpa.Id=subway}
422  subway  TRACE  [main] openjpa.MetaData - Using metadata factory 
"org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory@6833f2".
453  subway  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class 
"org.apache.openjpa.jdbc.sql.DerbyDictionary".
484  subway  INFO   [main] openjpa.Tool - Mapping tool running on type 
"class com.softbrands.subway.core.db.data.MessageEntity" with action 
"buildSchema".
484  subway  TRACE  [main] openjpa.MetaData - Using metadata factory 
"org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory@717d91".
500  subway  TRACE  [main] openjpa.MetaData - Loading metadata for 
"class com.softbrands.subway.core.db.data.MessageEntity" under mode 
"[META][QUERY]".
500  subway  TRACE  [main] openjpa.MetaData - Scanning resource 
"META-INF/orm.xml" for persistent types.
500  subway  TRACE  [main] openjpa.MetaData - parsePersistentTypeNames() 
found [].
500  subway  TRACE  [main] openjpa.MetaData - Found 0 classes with 
metadata in 0 milliseconds.
641  subway  TRACE  [main] openjpa.MetaData - Parsing class 
"com.softbrands.subway.core.db.data.MessageEntity".
<0.9.7-incubating fatal user error> 
org.apache.openjpa.util.MetaDataException: Type "class 
com.softbrands.subway.core.db.data.MessageEntity" does not have 
persistence metadata.
        at 
org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
        at 
org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:742)
        at 
org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:640)
        at 
org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1063)
        at 
org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:190)
        at 
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:169)
        at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at 
org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108)
        at 
org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:83)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at 
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
688  subway  TRACE  [main] openjpa.MetaData - Clearing metadata 
repository "org.apache.openjpa.jdbc.meta.MappingRepository@38fff7".


*However* it does work if I invoke it as a java task
<java classname="org.apache.openjpa.jdbc.meta.MappingTool" 
classpathref="maven.runtime.classpath">
  <arg line="-sa build -sql test.sql 
${project.build.sourceDirectory}/classes/com/softbrands/subway/core/db/data/MessageEntity.java"/>
</java>

Could this really be a classpath problem?

Pinaki Poddar wrote:
> Hi,
>   
>> Is it actually possible to generate tables using only the annotations
>>     
> in the entity class?
> Yes.
>
> Please post the log and stack trace with <property name="openjpa.Log"
> value="DefaultLevel=TRACE"/>
> Also the snippet of the Ant target you are invoking for mappingtool.
> Please note that alternatively
> <java classname="org.apache.openjpa.jdbc.meta.MappingTool"> can be used
> to invoke MappingTool from Ant 
> And I find that somewhat easier to debug build/classpath problems.
>
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: Makas Tzavellas [mailto:ducknight@gmail.com] 
> Sent: Monday, June 25, 2007 10:24 AM
> To: dev@openjpa.apache.org
> Subject: Using ant task mappingtool to generate tables
>
> Hi everyone,
>
> I'm trying to use mappingtool's ant task to generate tables for my
> entity classes. Problem is that it keeps complaining that my entity
> class does not have persistance metadata. The metadata is available as
> annotations in the entity class. Is it actually possible to generate
> tables using only the annotations in the entity class? Another thing is
> that I would like to avoid specifying the <class> element in the
> persistence.xml file as there are plans to dynamically drop new
> persistence classes while the application is running. Please advice!
>
> This is the following error that I am getting.
> Embedded error: <0.9.7-incubating fatal user error>
> org.apache.openjpa.util.MetaDataException: Type "class
> com.softbrands.subway.core.db.data.MessageEntity" does not have
> persistence metadata.
>
> This is the entity class
> @Entity
> @Table(name="MESSAGES", schema="MESSAGES") public class MessageEntity {
>     @Id @GeneratedValue(strategy=GenerationType.SEQUENCE)
> @Column(name="ID")
>     private long m_Id;
>    
>     @Version
>     @Column(name="OPTLOCK")
>     private int m_Version; // This is used by JPA implementation to
> carry out optimistic locking.
>    
>     @Column(name="SIBLING_ID")
>     private MessageEntity m_Sibling;
>    
>     @Column(name="STATUS")
>     private String m_Status;
> }
>
>
>
> Sincerely,
> Makas
>
> Notice:  This email message, together with any attachments, may contain information 
of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,
 proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use
of the individual or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this by email and then
delete it.
>
>   


Mime
View raw message