One of Torque's limitations, I'm fairly sure, is that you have to
TURBINE_USER in your weblog schema to refer to in via foreign keys and
what not. You can get around this by putting in a dummy TURBINE_USER
table and setting alias=true (which basically tells the om generation
code to ignore it).

E.g.:

  <table name="TURBINE_USER" javaName="TurbineUser" alias="TurbineUser"
    baseClass="org.apache.fulcrum.security.impl.db.entity.TurbineUser"
 
basePeer="org.apache.fulcrum.security.impl.db.entity.TurbineUserPeer">
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
  </table>

- Stephen

> -----Original Message-----
> From: Jeff Linwood [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, September 07, 2002 12:52 PM
> To: Turbine Torque Users List
> Subject: Problems with foreign keys and Turbine tables
> 
> Hi,
> 
> I'm using the version of Torque that comes with the TDK 2.1, and I'm
having
> a problem creating a foreign key reference from my classes to the
> TURBINE_USER table.  It appears that the problem is my
weblog-schema.xml
> file references the TURBINE_USER defined in turbine-schema.xml, and
they are
> referenced in different places. How do I fix this?
> 
> Here is my  foreign key:
>      <foreign-key foreignTable="TURBINE_USER">
>        <reference local="member_id" foreign="USER_ID"/>
>       </foreign-key>
> 
> This seems to work if I put the relevant parts of the turbine schema
in my
> schema file, but I don't want to do that.
> 
> The turbine_user table does exist in MySQL, so that shouldn't be the
> problem.
> 
> Thanks,
> Jeff
> 
> [torque-om]
> C:\tdk\webapps\weblog\WEB-INF\src\java\report.weblog.om.generation
> [torque-om] ERROR!! Attempt to set foreign key to nonexistent table,
> TURBINE_USE
> R!
> [torque-om] java.lang.NullPointerException
> [torque-om]     at
> org.apache.turbine.torque.engine.database.transform.XmlToAppD
> ata.startElement(XmlToAppData.java:237)
> [torque-om]     at
> org.apache.xerces.parsers.SAXParser.startElement(SAXParser.ja
> va:1376)
> [torque-om]     at
> org.apache.xerces.validators.common.XMLValidator.callStartEle
> ment(XMLValidator.java:1122)
> [torque-om]     at
> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XM
> LDocumentScanner.java:1858)
> [torque-om]     at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatc
> her.dispatch(XMLDocumentScanner.java:1234)
> [torque-om]     at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLD
> ocumentScanner.java:381)
> [torque-om]     at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:95
> 2)
> [torque-om]     at
> org.apache.turbine.torque.engine.database.transform.XmlToAppD
> ata.parseFile(XmlToAppData.java:152)
> [torque-om]     at
> org.apache.turbine.torque.TorqueObjectModelTask.initControlCo
> ntext(TorqueObjectModelTask.java:148)
> [torque-om]     at
> org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.jav
> a)
> <<Ant stuff snipped>>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>


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

Reply via email to