You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Christine Keim <im...@ycn.com> on 2002/07/03 00:40:11 UTC

torque in tdk 2.1 - how to generate only the OM-classes without tables

I need to generate OM-Classes which i declare with torque, but
not the tables that go along with them. I am in need of the classes with
the declared attributes and getter/setter methods but don't need them
to be mapped to the db (cause those attributes are being stored somewhere else).

Now, i thought skipSql would do the trick, but ant stops in the middle of generating 
the oms with a Exception from generator.parse (exactly on the OM-Class where i use skipSql).
Well, anyway, does someone know if that's the right path? (i don't want to look
into the problem if skipSql isn't suited for this).

To clarify, here an excerpt of the project-schema.xml:

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

Now, Product is a subclass of KnowledgeObject and it is generated accordingly if i take away
the "skipSql", only a table is generated which i don't want, also the Peer should not have 
methods to fill that table (cause i store the data elsewhere). Is skipSql here a option and if 
yes, anyone knows what could cause the troubles when generating the om-classes?

I also tried with this, but it seems that when i declare the table as an alias no columns/attributes are being adopted:

  <table name="Product" javaName="Product" alias="KnowledgeObject"
  baseClass="iknow.share.om.KnowledgeObject"
  basePeer="iknow.share.om.KnowledgeObjectPeer">

here is what the -debug option says when axecuting ant init with skipSql in the project-schema:

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)


tia, Christine

PS: it says to look into the velocity log, but there isn't written anything at all.

Re: torque in tdk 2.1 - how to generate only the OM-classes without tables

Posted by Christine Keim <im...@ycn.com>.
that is not what i was talking about. I am in need of a OM-Class stating
the attributes i declare in the project-schema, i don't need the
Peer-Objects and
i don't want things like a save-method, as well as i don't need the tables.
I know i can generate only the OM-Classes when i use ant project-om,
though i want to be able to use ant init and all will work like i want.
In short, i want java-classes to be generated which only have in them the
atributes stated in the schema as well as the getter/setter-Methods, plus
the hierarchy (Superclass) i define in the project-schema.xml
I think skipSql is the key to my problem, but ant blocks in the generation
of the
om-classes (and since it blocks there, it will also block with ant
project.-om).

Thanks anyway though ^^

Christine

----- Original Message -----
From: "Stefan Friedle" <st...@t-systems.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Wednesday, July 03, 2002 12:49 PM
Subject: Re: torque in tdk 2.1 - how to generate only the OM-classes without
tables


> Christine Keim wrote:
> > I need to generate OM-Classes which i declare with torque, but
> > not the tables that go along with them. I am in need of the classes with
> > the declared attributes and getter/setter methods but don't need them
> > to be mapped to the db (cause those attributes are being stored
somewhere else).
> [...]
>
>    Have you tried the 'project-om' task:
>
> $ ant project-om
>
>    HTH, Stefan
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque in tdk 2.1 - how to generate only the OM-classes without tables

Posted by Stefan Friedle <st...@t-systems.com>.
Christine Keim wrote:
> I need to generate OM-Classes which i declare with torque, but
> not the tables that go along with them. I am in need of the classes with
> the declared attributes and getter/setter methods but don't need them
> to be mapped to the db (cause those attributes are being stored somewhere else).
[...]

   Have you tried the 'project-om' task:

$ ant project-om

   HTH, Stefan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>