Hello all:

I'm new to Torque so probably my question is simple.

I'm using the newest Torque and Postgres with JDBC 7.2

I have a table named accesslog and the appropied torque classes (Data objects and 
peers). I'm using idbroker as the
default id method for the database and this table has an autoincremented primary key, 
so the idmethod is native.

Here is the schema:

<!--=========================================================================================-->
<!-- ACCESSLOG    -->
<!--=========================================================================================-->

  <table name="accesslog" description="Registro del acceso de los usuarios al sistema" 
idMethod="native">
    <column 
        name="accesslogID" 
        required="true" 
        type="BIGINT" 
        autoIncrement="true" 
        primaryKey="true"
        description="identificador del registro"/>
    <column 
        name="usuarioID"   
        required="true" 
        type="BIGINT"
        description="Usuario que accesa o sale"/>
    <column 
        name="tipolog"      
        required="true" 
        type="VARCHAR" 
        size="8" 
        description="tipo de registro login/logout"/>
        <column 
                name="fecha"      
                required="true" 
                type="TIMESTAMP"
                description="fecha del registro"/>    
    
    <index name="ACCESSLOGID_INDEX">
      <index-column name="accesslogID"/>
    </index>
    
    <index name ="ACCESSLOGUSERID_INDEX">
        <index-column name="usuarioID"/>
    </index>

    <foreign-key foreignTable="usuario">
        <reference local="usuarioID" foreign="usuarioID"/>
    </foreign-key>


  </table> 


When I insert data into this table via the code: 

   Accesslog testAccess = new Accesslog();
   testAccess.setFecha(Calendar.getInstance().getTime());
   testAccess.setUsuarioid(2);         
testAccess.setTipolog(ConstantManager.ACESSLOG_LOGOUT);
  AccesslogPeer.doInsert(testAccess);


The data is properly stored in the database (with incremented primary key and 
everything) but i get this exception over and over:

Error: org.apache.torque.TorqueException: ERROR:  accesslog_seq.currval is not yet 
defined in this session


Any idea why this is happening?.

My guess is it has something to do with the sequences in postgres, but i don't know 
what.

Thanks in advanced.


Carlos Olmos.



Need a new email address that people can remember
Check out the new EudoraMail at
http://www.eudoramail.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to