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 Don Vawter <do...@vawter.com> on 2004/10/29 21:18:45 UTC

IdGenerator is null

This is appearing in the logs:

DEBUG,2004-10-29 
13:07:28,com.vawter.omreporting.utility.DatabaseUpdate,Torque 
exceptionIdGenerator for table 'tbl_Metric' is null

The table use native autoincrement and from the snippets below 
everything looks ok in db.

Does anybody have a clue as to why I am getting this?



Here is the DDL from MySQL

CREATE TABLE `tbl_Metric` (
  `metric_id` int(11) NOT NULL auto_increment,
  `metric` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`metric_id`)
) TYPE=InnoDB

So the table should autoincrement the key

Here is the relevant snippet from the schema


<database
  name="omreporting"
  defaultIdMethod="native"
           package="com.vawter.omreporting.om" >

                        <table name="tbl_Metric" description="Metrics" 
idMethod="native">
    <column
      name="metric_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
 autoIncrement="true"
      description="Metric Id"/>


and here is a snippet from  TblMetricMapBuilder.java


   public void doBuild() throws TorqueException
    {
        dbMap = Torque.getDatabaseMap("omreporting");

        dbMap.addTable("tbl_Metric");
        TableMap tMap = dbMap.getTable("tbl_Metric");

        tMap.setPrimaryKeyMethod(TableMap.NATIVE);


              tMap.addPrimaryKey("tbl_Metric.METRIC_ID", new Integer(0));
                    tMap.addColumn("tbl_Metric.METRIC", new String());
          }
}


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


Re: IdGenerator is null

Posted by Don Vawter <do...@vawter.com>.
never mind. When I was changing the init statement for Torque I left 
both the old and new init's in the code.
It is a known result that initing it more than once leads to the 
exception shown. (thanks to 
http://wiki.apache.org/db-torque/GettingTorqueToWork )


Don Vawter wrote:

>
> This is appearing in the logs:
>
> DEBUG,2004-10-29 
> 13:07:28,com.vawter.omreporting.utility.DatabaseUpdate,Torque 
> exceptionIdGenerator for table 'tbl_Metric' is null
>
> The table use native autoincrement and from the snippets below 
> everything looks ok in db.
>
> Does anybody have a clue as to why I am getting this?
>
>
>
> Here is the DDL from MySQL
>
> CREATE TABLE `tbl_Metric` (
>  `metric_id` int(11) NOT NULL auto_increment,
>  `metric` varchar(50) NOT NULL default '',
>  PRIMARY KEY  (`metric_id`)
> ) TYPE=InnoDB
>
> So the table should autoincrement the key
>
> Here is the relevant snippet from the schema
>
>
> <database
>  name="omreporting"
>  defaultIdMethod="native"
>           package="com.vawter.omreporting.om" >
>
>                        <table name="tbl_Metric" description="Metrics" 
> idMethod="native">
>    <column
>      name="metric_id"
>      required="true"
>      primaryKey="true"
>      type="INTEGER"
> autoIncrement="true"
>      description="Metric Id"/>
>
>
> and here is a snippet from  TblMetricMapBuilder.java
>
>
>   public void doBuild() throws TorqueException
>    {
>        dbMap = Torque.getDatabaseMap("omreporting");
>
>        dbMap.addTable("tbl_Metric");
>        TableMap tMap = dbMap.getTable("tbl_Metric");
>
>        tMap.setPrimaryKeyMethod(TableMap.NATIVE);
>
>
>              tMap.addPrimaryKey("tbl_Metric.METRIC_ID", new Integer(0));
>                    tMap.addColumn("tbl_Metric.METRIC", new String());
>          }
> }
>
>
> ---------------------------------------------------------------------
> 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