You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by pyaar <um...@rediffmail.com> on 2007/12/17 12:04:19 UTC

Torque Runtime errors:-Invalid object name "ID_Table"

Hi all

i am using mssql server 2000,torque 3.2.I am trying to execute java
com.kazmier.Bookstore from the command as given in the sample application in
http://db.apache.org/torque/releases/torque-3.1/tutorial/step4.html
but i am getting the following error


org.apache.torque.TorqueException: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name
'ID_TABLE'.
	at org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:103)
	at org.apache.torque.util.BasePeer.getId(BasePeer.java:570)
	at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:503)
	at org.apache.torque.BasePublisherPeer.doInsert(BasePublisherPeer.java:210)
	at org.apache.torque.BasePublisherPeer.doInsert(BasePublisherPeer.java:556)
	at org.apache.torque.BasePublisher.save(BasePublisher.java:531)
	at org.apache.torque.BasePublisher.save(BasePublisher.java:495)
	at org.apache.torque.BasePublisher.save(BasePublisher.java:475)
	at org.apache.BookStore.main(BookStore.java:23)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Invalid object name 'ID_TABLE'.
	at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
	at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
	at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
Source)
	at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
Source)
	at
com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown
Source)
	at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
	at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown
Source)
	at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown
Source)
	at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
	at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
	at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown
Source)
	at com.microsoft.jdbc.base.BaseStatement.executeUpdate(Unknown Source)
	at org.apache.torque.oid.IDBroker.updateQuantity(IDBroker.java:902)
	at org.apache.torque.oid.IDBroker.storeIDs(IDBroker.java:649)
	at org.apache.torque.oid.IDBroker.getNextIds(IDBroker.java:419)
	at org.apache.torque.oid.IDBroker.getIdAsBigDecimal(IDBroker.java:307)
	at org.apache.torque.util.BasePeer.getId(BasePeer.java:559)
	... 7 more
 my bookstore-schema.xml file is as under

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!--
 Copyright 2001-2005 The Apache Software Foundation.

 Licensed under the Apache License, Version 2.0 (the "License")
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<!DOCTYPE database SYSTEM
"http://db.apache.org/torque/dtd/database_3_2.dtd">

<!-- ====================================================================
-->
<!--                                                                     
-->
<!-- I D  B R O K E R  S C H E M A                                       
-->
<!--                                                                     
-->
<!-- ====================================================================
-->
<!-- This is the XML schema use by Torque to generate the SQL for        
-->
<!-- ID_TABLE table used by the id broker mechanism in Torque.           
-->
<!-- ====================================================================
-->
<!-- @author:  mailto:jvanzyl@apache.org Jason van Zyl        -->
<!-- @version $Id: id-table-schema.xml 239624 2005-08-24 12:18:03Z henning $
-->
<!-- ====================================================================
-->
<database
  name="bookstore"
  defaultIdMethod="idbroker">

  <table name="book" description="Book Table">
    <column
      name="book_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Book Id"/>
    <column
      name="title"
      required="true"
      type="VARCHAR"
      size="255"
      description="Book Title"/>
    <column
      name="isbn"
      required="true"
      type="VARCHAR"
      size="24"
      javaName="ISBN"
      description="ISBN Number"/>
    <column
      name="publisher_id"
      required="true"
      type="INTEGER"
      description="Foreign Key Publisher"/>
    <column
      name="author_id"
      required="true"
      type="INTEGER"
      description="Foreign Key Author"/>
    <foreign-key foreignTable="publisher">
      <reference
        local="publisher_id"
        foreign="publisher_id"/>
    </foreign-key>
    <foreign-key foreignTable="author">
      <reference
        local="author_id"
        foreign="author_id"/>
    </foreign-key>
  </table>
  <table name="publisher" description="Publisher Table">
    <column
      name="publisher_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Publisher Id"/>
    <column
      name="name"
      required="true"
      type="VARCHAR"
      size="128"
      description="Publisher Name"/>
  </table>
  <table name="author" description="Author Table">
    <column
      name="author_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Author Id"/>
    <column
      name="first_name"
      required="true"
      type="VARCHAR"
      size="128"
      description="First Name"/>
    <column
      name="last_name"
      required="true"
      type="VARCHAR"
      size="128"
      description="Last Name"/>
  </table>
</database>


i guess its something related to defaultidMethod

i am trying to execute the application in the following order

1)ant -f build-torque.xml
2)ant -f build-torque.xml compile
3)ant -f build-torque.xml id-table-init-sql

at this stage bookstore-schema-idtable-init.sql  file  is generated 

which contains

insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
(101, 'book', 1000, 10);
insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
(102, 'publisher', 1000, 10);
insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
(103, 'author', 1000, 10);

4)ant -f build-torque.xml insert-sql

at this stage tables are successfully created in database

5)ant -f build-torque.xml compile

all the necessary java objects are created

6)java com.kazmier.Bookstore
 this is the problem area ,having error shown above

any body here please help
-- 
View this message in context: http://www.nabble.com/Torque-Runtime-errors%3A-Invalid-object-name-%22ID_Table%22-tp14370223p14370223.html
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Torque Runtime errors:-Invalid object name "ID_Table"

Posted by Thomas Fischer <fi...@seitenbau.net>.
It seems that you forgot to execute the command

maven torque:id-table-init-sql

from http://db.apache.org/torque/releases/torque-3.3/tutorial/step3.html

   Thomas

pyaar <um...@rediffmail.com> schrieb am 17.12.2007 12:04:19:

>
> Hi all
>
> i am using mssql server 2000,torque 3.2.I am trying to execute java
> com.kazmier.Bookstore from the command as given in the sample application
in
> http://db.apache.org/torque/releases/torque-3.1/tutorial/step4.html
> but i am getting the following error
>
>
> org.apache.torque.TorqueException: java.sql.SQLException:
> [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name
> 'ID_TABLE'.
>    at
org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:103)
>    at org.apache.torque.util.BasePeer.getId(BasePeer.java:570)
>    at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:503)
>    at
org.apache.torque.BasePublisherPeer.doInsert(BasePublisherPeer.java:210)
>    at
org.apache.torque.BasePublisherPeer.doInsert(BasePublisherPeer.java:556)
>    at org.apache.torque.BasePublisher.save(BasePublisher.java:531)
>    at org.apache.torque.BasePublisher.save(BasePublisher.java:495)
>    at org.apache.torque.BasePublisher.save(BasePublisher.java:475)
>    at org.apache.BookStore.main(BookStore.java:23)
> Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC][SQLServer]Invalid object name 'ID_TABLE'.
>    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
Source)
>    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
>    at
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown
> Source)
>    at
com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown
> Source)
>    at
>
com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown

> Source)
>    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown
Source)
>    at
>
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown

> Source)
>    at
com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown
> Source)
>    at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown
Source)
>    at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
>    at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown
> Source)
>    at com.microsoft.jdbc.base.BaseStatement.executeUpdate(Unknown Source)
>    at org.apache.torque.oid.IDBroker.updateQuantity(IDBroker.java:902)
>    at org.apache.torque.oid.IDBroker.storeIDs(IDBroker.java:649)
>    at org.apache.torque.oid.IDBroker.getNextIds(IDBroker.java:419)
>    at org.apache.torque.oid.IDBroker.getIdAsBigDecimal(IDBroker.java:307)
>    at org.apache.torque.util.BasePeer.getId(BasePeer.java:559)
>    ... 7 more
>  my bookstore-schema.xml file is as under
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <!--
 Copyright 2001-2005 The Apache Software Foundation.

 Licensed under
the
> Apache License, Version 2.0 (the "License")
 you may not use this file
except
> in compliance with the License.
 You may obtain a copy of the License at

> http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable
law
> or agreed to in writing, software
 distributed under the License is
> distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY
> KIND, either express or implied.
 See the License for the specific
language
> governing permissions and
 limitations under the License.
-->
> <!DOCTYPE database SYSTEM
> "http://db.apache.org/torque/dtd/database_3_2.dtd">
>
> <!-- ====================================================================
-->
> <!--
-->
> <!-- I D  B R O K E R  S C H E M A
-->
> <!--
-->
> <!-- ====================================================================
-->
> <!-- This is the XML schema use by Torque to generate the SQL for
-->
> <!-- ID_TABLE table used by the id broker mechanism in Torque.
-->
> <!-- ====================================================================
-->
> <!-- @author:  mailto:jvanzyl@apache.org Jason van Zyl        -->
> <!-- @version $Id: id-table-schema.xml 239624 2005-08-24 12:18:03Z
henning $
-->
> <!-- ====================================================================
-->
> <database
>   name="bookstore"
>   defaultIdMethod="idbroker">
>
>   <table name="book" description="Book Table">
>     <column
>       name="book_id"
>       required="true"
>       primaryKey="true"
>       type="INTEGER"
>       description="Book Id"/>
>     <column
>       name="title"
>       required="true"
>       type="VARCHAR"
>       size="255"
>       description="Book Title"/>
>     <column
>       name="isbn"
>       required="true"
>       type="VARCHAR"
>       size="24"
>       javaName="ISBN"
>       description="ISBN Number"/>
>     <column
>       name="publisher_id"
>       required="true"
>       type="INTEGER"
>       description="Foreign Key Publisher"/>
>     <column
>       name="author_id"
>       required="true"
>       type="INTEGER"
>       description="Foreign Key Author"/>
>     <foreign-key foreignTable="publisher">
>       <reference
>         local="publisher_id"
>         foreign="publisher_id"/>
>     </foreign-key>
>     <foreign-key foreignTable="author">
>       <reference
>         local="author_id"
>         foreign="author_id"/>
>     </foreign-key>
>   </table>
>   <table name="publisher" description="Publisher Table">
>     <column
>       name="publisher_id"
>       required="true"
>       primaryKey="true"
>       type="INTEGER"
>       description="Publisher Id"/>
>     <column
>       name="name"
>       required="true"
>       type="VARCHAR"
>       size="128"
>       description="Publisher Name"/>
>   </table>
>   <table name="author" description="Author Table">
>     <column
>       name="author_id"
>       required="true"
>       primaryKey="true"
>       type="INTEGER"
>       description="Author Id"/>
>     <column
>       name="first_name"
>       required="true"
>       type="VARCHAR"
>       size="128"
>       description="First Name"/>
>     <column
>       name="last_name"
>       required="true"
>       type="VARCHAR"
>       size="128"
>       description="Last Name"/>
>   </table>
> </database>
>
>
> i guess its something related to defaultidMethod
>
> i am trying to execute the application in the following order
>
> 1)ant -f build-torque.xml
> 2)ant -f build-torque.xml compile
> 3)ant -f build-torque.xml id-table-init-sql
>
> at this stage bookstore-schema-idtable-init.sql  file  is generated
>
> which contains
>
> insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
> (101, 'book', 1000, 10);
> insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
> (102, 'publisher', 1000, 10);
> insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
> (103, 'author', 1000, 10);
>
> 4)ant -f build-torque.xml insert-sql
>
> at this stage tables are successfully created in database
>
> 5)ant -f build-torque.xml compile
>
> all the necessary java objects are created
>
> 6)java com.kazmier.Bookstore
>  this is the problem area ,having error shown above
>
> any body here please help
> --
> View this message in context:
http://www.nabble.com/Torque-Runtime-errors%3A-
> Invalid-object-name-%22ID_Table%22-tp14370223p14370223.html
> Sent from the Apache DB - Torque Users mailing list archive at
Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org