db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Galil <Guy_Ga...@guardium.com>
Subject Re: Inheritance in database
Date Tue, 22 Nov 2005 17:08:57 GMT
Hi
I use inheritance in a few places, it is a very neat feature - you
should probably look at the documentation but I can give you a simple
example:
I have a table that holds the information used to purge historic data,
the name of objects to purge, the age, purge executor type and
additional data.

<table name="PURGE_SETUP" description="">
     <column
      name="PURGE_SETUP_ID"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Id"/>
      <column 
      name="PURGE_EXECUTOR_TYPE"
      type="TINYINT"
      required="true"
      default="0"
      description="0 for sql, 1 for java"
       inheritance="single"
      >
      	<inheritance key="0" class="SqlPurgeExcutor" />
   	<inheritance key="1" class="JavaPurgeExcutor" />
   	 </column>	 
       <column 
      name="OBJECT_NAME"
      type="VARCHAR"
      size="255"
      required="true"
      description="Table name for type sql, class name for type java"
      />
       <column 
      name="ADDITIONAL_INFO"
      type="VARCHAR"
      size="255"
      description="Addtional where clause for sql, Method name for java"
      />
       <column 
      name="AGE"
      type="INTEGER"
      required="true"
      description=""
      />
      <column 
      name="OBJECT_DESC"
      type="VARCHAR"
      size="255"
      description="A Name for user interface"
      />
  </table>

When I use Torque to retrieve data from this table the list I get
contains objects of type SqlPurgeExcutor or JavaPurgeExcutor according
to the value of PURGE_EXECUTOR_TYPE.

Hope this helps.
Guy
On Sun, 2005-11-20 at 21:54 +0100, Jakub Piechnik wrote:
> Hello
> 
> Has anyone can tell me anything about inheritance in torque schema? I 
> know that there is a key-word inheritance, but what exactly menas key, 
> class, single, etc in this?
> 
> I have a table with 6 columns - one of which is boolean for distinguish 
> which class should be created of inserted data. Both two classes use the 
> same fields - so - can You tell me, how should I set it up in torque?
> 
> I would be vere grateful for any help
> 
> Greetings
> Jakub Piechnik
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message