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 Da...@dadebehring.com on 2003/10/16 11:27:41 UTC

Foreign-Key Problem

Hi,

I have the following Problem with my turbine-project (fcar):

in <WEB-INF/conf/turbine-schema.xml> I have:

---
<Database name=turbine>
...
<table name="TURBINE_USER" idMethod="idbroker">
    <column name="USER_ID" required="true" primaryKey="true" 
type="INTEGER"/>
    <column name="LOGIN_NAME" required="true" size="32" type="VARCHAR"/>
    <column name="PASSWORD_VALUE" required="true" size="32" 
type="VARCHAR"/>
    <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="EMAIL" size="99" type="VARCHAR"/>
    <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
    <column name="MODIFIED" type="TIMESTAMP"/>
    <column name="CREATED" type="TIMESTAMP"/>
    <column name="LAST_LOGIN" type="TIMESTAMP"/>
    <column name="OBJECTDATA" type="VARBINARY"/>

    <unique>
        <unique-column name="LOGIN_NAME"/>
    </unique>

</table>
...
----

and in <fcar-schema.xml> :

---
<database name="fcar">
  <table name="FCAR_ADDRESS" idMethod="idbroker">
    <column name="ADDRESS_ID" required="true" primaryKey="true" 
type="INTEGER"/>
    <column name="USER_ID" required="true" type="INTEGER"/>
    <column name="STREET" size="255" type="VARCHAR"/>
    <column name="NR" type="INTEGER"/>
    <column name="CITY" size="255" type="VARCHAR"/>
    <column name="PLZ" type="INTEGER"/>

   <foreign-key foreignTable="TURBINE_USER">
      <reference local="USER_ID" foreign="USER_ID" />
    </foreign-key> 

  </table>
</database>
---

ant init now tells me:

---
...
sql-classpath:
[torque-sql] Using contextProperties file: 
/opt/tdk-2.2/webapps/fcar/WEB-INF/build/build.properties
[torque-sql] Using classpath
[torque-sql] Generating to file 
/opt/tdk-2.2/webapps/fcar/WEB-INF/src/sql/report.fcar.sql.generation
[torque-sql] Resolver: used database.dtd from 
org.apache.torque.engine.database.transform package
[torque-sql] Resolver: used database.dtd from 
org.apache.torque.engine.database.transform package
[torque-sql] Resolver: used database.dtd from 
org.apache.torque.engine.database.transform package
!! --> [torque-sql] ERROR!! Attempt to set foreign key to nonexistent 
table, TURBINE_USER! 

BUILD FAILED
file:/opt/tdk-2.2/webapps/fcar/WEB-INF/build/build-torque.xml:198: 
Generation failed. For more information consult the velocity log, or 
invoke ant with the -debug flag.
...
---

Of course, it's another Database-name for Torque, but isn't that kind of 
cross referencing possible, or is there a good workaround? Because I'd 
very much like to use Turbine's user/permission management capabilities 
directly in my application, where I might have a lot of tables, that need 
FK's to entries in the turbine-tables.

Thank you,

David

Re: Foreign-Key Problem

Posted by Scott Eade <se...@backstagetech.com.au>.
Your question would be best addressed on the turbine users mailing
list - turbine-user@jakarta.apache.org.  I see that you attempted
to cross post, but you got the domain name wrong (BTW: please don't
cross post :-)

The answer you seek can be found here:
http://jakarta.apache.org/turbine/turbine-2.3/howto/extend-user-howto.html
The content of this document relates to Turbine 2.2.  I strongly
recommend moving to Turbine 2.3 if at all possible since it is
much much easier to do this kind of thing.  The page for T2.3 is
http://jakarta.apache.org/turbine/turbine-2.3/services/torque-security-service.html
(the link near the top of extend-user-howto is fixed in cvs, but
waiting for the site to be republished).

Good luck.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



David_Solbach/MR/de/DadeInt@dadebehring.com wrote:

>Hi,
>
>I have the following Problem with my turbine-project (fcar):
>
>in <WEB-INF/conf/turbine-schema.xml> I have:
>
>---
><Database name=turbine>
>...
><table name="TURBINE_USER" idMethod="idbroker">
>    <column name="USER_ID" required="true" primaryKey="true" 
>type="INTEGER"/>
>    <column name="LOGIN_NAME" required="true" size="32" type="VARCHAR"/>
>    <column name="PASSWORD_VALUE" required="true" size="32" 
>type="VARCHAR"/>
>    <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
>    <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
>    <column name="EMAIL" size="99" type="VARCHAR"/>
>    <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
>    <column name="MODIFIED" type="TIMESTAMP"/>
>    <column name="CREATED" type="TIMESTAMP"/>
>    <column name="LAST_LOGIN" type="TIMESTAMP"/>
>    <column name="OBJECTDATA" type="VARBINARY"/>
>
>    <unique>
>        <unique-column name="LOGIN_NAME"/>
>    </unique>
>
></table>
>...
>----
>
>and in <fcar-schema.xml> :
>
>---
><database name="fcar">
>  <table name="FCAR_ADDRESS" idMethod="idbroker">
>    <column name="ADDRESS_ID" required="true" primaryKey="true" 
>type="INTEGER"/>
>    <column name="USER_ID" required="true" type="INTEGER"/>
>    <column name="STREET" size="255" type="VARCHAR"/>
>    <column name="NR" type="INTEGER"/>
>    <column name="CITY" size="255" type="VARCHAR"/>
>    <column name="PLZ" type="INTEGER"/>
>
>   <foreign-key foreignTable="TURBINE_USER">
>      <reference local="USER_ID" foreign="USER_ID" />
>    </foreign-key> 
>
>  </table>
></database>
>---
>
>ant init now tells me:
>
>---
>...
>sql-classpath:
>[torque-sql] Using contextProperties file: 
>/opt/tdk-2.2/webapps/fcar/WEB-INF/build/build.properties
>[torque-sql] Using classpath
>[torque-sql] Generating to file 
>/opt/tdk-2.2/webapps/fcar/WEB-INF/src/sql/report.fcar.sql.generation
>[torque-sql] Resolver: used database.dtd from 
>org.apache.torque.engine.database.transform package
>[torque-sql] Resolver: used database.dtd from 
>org.apache.torque.engine.database.transform package
>[torque-sql] Resolver: used database.dtd from 
>org.apache.torque.engine.database.transform package
>!! --> [torque-sql] ERROR!! Attempt to set foreign key to nonexistent 
>table, TURBINE_USER! 
>
>BUILD FAILED
>file:/opt/tdk-2.2/webapps/fcar/WEB-INF/build/build-torque.xml:198: 
>Generation failed. For more information consult the velocity log, or 
>invoke ant with the -debug flag.
>...
>---
>
>Of course, it's another Database-name for Torque, but isn't that kind of 
>cross referencing possible, or is there a good workaround? Because I'd 
>very much like to use Turbine's user/permission management capabilities 
>directly in my application, where I might have a lot of tables, that need 
>FK's to entries in the turbine-tables.
>
>Thank you,
>
>David
>  
>




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