hi there,

i'm using TDK 2.1 and the added Torque version.
I am in need of Torque to let me generate classes from the project-schema.xml,
which only hold the the attributes i stated in the xml and absolutely do NOT
generate any save-Methods and Peers as well as no table.

This is because i have a SuperClass which holds all relevant items, and the 
subclasses i want to generate are only holders for attributes which don't go
in the relational DB (they go in a XML-DB actually).

I tried to achieve my goal in different ways.

a) i tried to define an alias for a table since i thought this doesn't generate
the table. I was right for the table, but look at the field test i wanted to
be generated as a property of the class Product as well as their getter/setter-Methods.
It didn't generate it at all.

  <table name="Product" javaName="Product" alias="KnowledgeObject"
  baseClass="iknow.share.om.KnowledgeObject">
    <!-- Unique identifier -->
    <column name="id" primaryKey="true" required="true" type="integer"/>
    <!-- Fields for XML -->
    <column name="test" size="255" type="VARCHAR"/>
  </table>

b) second try, i looked into the database.dtd. There i found skipSql. Now i really
don't know what this does(i didn't find a doku of it), but it sounded really like 
something i maybe wanted. So i tried the following, which caused the table not 
to be created (good!) but at the generation of the OM-Classes ant stopped
with a generator.parse exception (it is thrown only when i use skipSql=true):

  <table name="Product" javaName="Product" skipSql="true"
  baseClass="iknow.share.om.KnowledgeObject">
    <!-- Unique identifier -->
    <column name="id" primaryKey="true" required="true" type="integer"/>
    <!-- Fields for XML -->
    <column name="test" size="255" type="VARCHAR"/>
  </table>

Now, i was wondering if someone could tell me if skipSql is the key to the solution
or there is something far more easy to accomplish what i want.

If skipSql is the right choice, maybe someone knows why the following exception is 
thrown?
Please help me! ^^

Christine

BUILD FAILED

/usr/local/share/tdk/webapps/km01/WEB-INF/build/build.xml:178: Exception thrown by 
'generator.parse'. For more information consult the velocity log.
at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:104)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:266)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)
--- Nested Exception ---
org.apache.velocity.exception.MethodInvocationException: Invocation of method 
'getJavaNative' in  class org.apache.turbine.torque.engine.database.model.Column threw 
exception class java.lang.NullPointerException
at 
org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java)
at org.apache.velocity.Template.merge(Template.java)
at org.apache.velocity.texen.Generator.parse(Generator.java)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java)
at org.apache.velocity.Template.merge(Template.java)
at org.apache.velocity.texen.Generator.parse(Generator.java)
at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:104)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:266)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)

 

Reply via email to