You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Noureddine BEKRAR <nb...@rennes.jouve.fr> on 2004/07/30 12:06:37 UTC

Repository.xml question

Hi all;

I want to put by an automatic way the generated "idProjectVersion" on the projectversions table as id of the versions related to the projectVersion.

Is it possible only by changing the repository.xml or should i change the structure of the Database?

Thank you in advance.





that is the repository.xml part



<class-descriptor class="Project" table="project">

<field-descriptor name="id" primarykey="true" nullable="false" default-fetch="true" autoincrement="true" 

column="id" sequence-name="project_id_seq" jdbc-type="INTEGER"/>

<field-descriptor name="name" column="name" jdbc-type="VARCHAR"/>

<field-descriptor name="idClient" column="idClient" jdbc-type="INTEGER"/>

<field-descriptor name="type" column="type" jdbc-type="VARCHAR"/>

<field-descriptor name="status" column="status" jdbc-type="VARCHAR"/> 

<collection-descriptor

name="versionsList"

collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollection"

element-class-ref="ProjectVersion"

auto-update="true" auto-delete="true">

<inverse-foreignkey field-ref="idProject"/>

</collection-descriptor>

</class-descriptor>



</class-descriptor>

<class-descriptor class="ProjectVersion" table="projectversions">

<field-descriptor name="idProjectVersion" primarykey="true" nullable="false" default-fetch="true" autoincrement="true" 

column="idProjectVersion" sequence-name="version_id_seq" jdbc-type="INTEGER"/>

<field-descriptor name="idProject" column="idProject" jdbc-type="INTEGER" />

<field-descriptor name="current" column="current" jdbc-type="VARCHAR" /> 

<collection-descriptor

name="versionsList"

collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollection"

element-class-ref="Version"

auto-update="true" auto-delete="false">

<inverse-foreignkey field-ref="id"/>

</collection-descriptor>

</class-descriptor>

<class-descriptor class="Version" table="projectversiondesc">

<field-descriptor name="id" column="id" jdbc-type="INTEGER" primarykey="true"/>

<field-descriptor name="lang" column="lang" jdbc-type="VARCHAR" primarykey="true"/> 

<field-descriptor name="description" column="description" jdbc-type="VARCHAR" />

<field-descriptor name="status" column="status" jdbc-type="VARCHAR" /> 

</class-descriptor>



that is tables

 
CREATE TABLE projectversions (
  idProjectVersion int(10) NOT NULL auto_increment,
  idProject int(10) NOT NULL default '0',
  current enum('Y','N') NOT NULL default 'N',
  PRIMARY KEY  (idProjectVersion,idProject)
) TYPE=MyISAM;

 
CREATE TABLE `projectversiondesc` (
  `id` int(10) NOT NULL default '0',
  `lang` enum('fr','en') NOT NULL default 'fr',
  `description` varchar(30) NOT NULL default '',
  `status` enum('A','I') NOT NULL default 'A',
  PRIMARY KEY  (`id`,`lang`)
) TYPE=MyISAM;

Re: Repository.xml question

Posted by Noureddine BEKRAR <nb...@rennes.jouve.fr>.
I want  to give more information about  my problem:
when i create a new ProjectVersion , i put in it a Version, the id of the
ProjectVersion is right but the id of the version is 0, how can i do to put
by an automatic way the id of the ProjectVersion  in the Version.



----- Original Message ----- 
From: "Noureddine BEKRAR" <nb...@jouve.fr>
To: <oj...@db.apache.org>
Sent: Friday, July 30, 2004 12:06 PM
Subject: Repository.xml question


Hi all;

I want to put by an automatic way the generated "idProjectVersion" on the
projectversions table as id of the versions related to the projectVersion.

Is it possible only by changing the repository.xml or should i change the
structure of the Database?

Thank you in advance.





that is the repository.xml part



<class-descriptor class="Project" table="project">

<field-descriptor name="id" primarykey="true" nullable="false"
default-fetch="true" autoincrement="true"

column="id" sequence-name="project_id_seq" jdbc-type="INTEGER"/>

<field-descriptor name="name" column="name" jdbc-type="VARCHAR"/>

<field-descriptor name="idClient" column="idClient" jdbc-type="INTEGER"/>

<field-descriptor name="type" column="type" jdbc-type="VARCHAR"/>

<field-descriptor name="status" column="status" jdbc-type="VARCHAR"/>

<collection-descriptor

name="versionsList"

collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollect
ion"

element-class-ref="ProjectVersion"

auto-update="true" auto-delete="true">

<inverse-foreignkey field-ref="idProject"/>

</collection-descriptor>

</class-descriptor>



</class-descriptor>

<class-descriptor class="ProjectVersion" table="projectversions">

<field-descriptor name="idProjectVersion" primarykey="true" nullable="false"
default-fetch="true" autoincrement="true"

column="idProjectVersion" sequence-name="version_id_seq"
jdbc-type="INTEGER"/>

<field-descriptor name="idProject" column="idProject" jdbc-type="INTEGER" />

<field-descriptor name="current" column="current" jdbc-type="VARCHAR" />

<collection-descriptor

name="versionsList"

collection-class="org.apache.ojb.broker.util.collections.RemovalAwareCollect
ion"

element-class-ref="Version"

auto-update="true" auto-delete="false">

<inverse-foreignkey field-ref="id"/>

</collection-descriptor>

</class-descriptor>

<class-descriptor class="Version" table="projectversiondesc">

<field-descriptor name="id" column="id" jdbc-type="INTEGER"
primarykey="true"/>

<field-descriptor name="lang" column="lang" jdbc-type="VARCHAR"
primarykey="true"/>

<field-descriptor name="description" column="description"
jdbc-type="VARCHAR" />

<field-descriptor name="status" column="status" jdbc-type="VARCHAR" />

</class-descriptor>



that is tables


CREATE TABLE projectversions (
  idProjectVersion int(10) NOT NULL auto_increment,
  idProject int(10) NOT NULL default '0',
  current enum('Y','N') NOT NULL default 'N',
  PRIMARY KEY  (idProjectVersion,idProject)
) TYPE=MyISAM;


CREATE TABLE `projectversiondesc` (
  `id` int(10) NOT NULL default '0',
  `lang` enum('fr','en') NOT NULL default 'fr',
  `description` varchar(30) NOT NULL default '',
  `status` enum('A','I') NOT NULL default 'A',
  PRIMARY KEY  (`id`,`lang`)
) TYPE=MyISAM;


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