Hi Quinton,
it's good to understand finally that the Turbine* om-classes are not needed
at all.
They don't need to be generated, as Turbine uses the classes that come along
with the org.apache.turbine package.
It's a miracle to me why the turbine-schema.xml file has not been removed in
the latest Turbine-release, or at least put into a separate dir to make
clear it is not needed (or rather must not) to be generated for a project.
Anyway, in order for the om-classes to compile I needed to add the following
changes to your patch:
1) TurbineUserAdapter.getUserId() must return int (not Integer)
public int getUserId()
{
return ((NumberKey)getPrimaryKey()).intValue();
//NOT: return new Integer(((NumberKey)getPrimaryKey()).intValue());
}
since the Base* classes expect int values, not Integer.
2) TurbineUserAdapter needs to implements method setPrimaryKey:
public void setPrimaryKey(String key) {
try {
super.setPrimaryKey(key);
}
catch (Exception ex) {
}
since
org.apache.torque.om.BaseObject:
public void setPrimaryKey(java.lang.String primaryKey)
throws java.lang.Exception
^^^^^^^^^^^^^^^^^^^^^^^^^^
This relates to the fact that Torque is still evolving whereas the Turbine
Security System (org.apache.turbine.om.security.*) seems at stand still.
I will check tomorrow if this solution will work as it is supposed to do.
Greetings
Marc
> -----Ursprungliche Nachricht-----
> Von: Quinton McCombs [mailto:[EMAIL PROTECTED]]
> Gesendet: Sonntag, 15. Dezember 2002 02:37
> An: 'Turbine Users List'
> Betreff: RE: Documentation update
>
>
> Ahh... You need to rename turbine-schema.xml to
> turbine-schema.xml.nogenerate (or anything besides *-schema.xml). Next,
> delete all of the om.Turbine*, om.BaseTurbine*, om.map.Turbine* classes
> that were generated. These classes are not used. They only make things
> more confusing.
>
> Now, your schema file.... You should not list TURBINE_USER as a table
> in your schema file. Instead, use AUDIOTEX_USER with an alias of
> TurbineUser. This will cause AudiotexUser, AudiotexUserPeer, and the
> associated Base* classes to be generated. The Base* classes will extend
> the adapters TurbineUserAdpater and TurbineUserPeerAdpaters,
> respectively. Foreign key references in your schema file should use the
> table name AUDIOTEX_USER.
>
> I have made the appropriate changes to your schema file below.
>
>
> <table name="AUDIOTEX_USER" alias="TurbineUser"
> baseClass="de.geoconnect.audiotex.om.TurbineUserAdapter"
> basePeer="de.geoconnect.audiotex.om.TurbineUserPeerAdapter">
> <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
> </table>
> <table name="KUNDE">
> <column name="KUNDE_ID" primaryKey="true"
> required="true" type="INTEGER"/>
> <foreign-key foreignTable="AUDIOTEX_USER">
> <reference local="KUNDE_ID" foreign="USER_ID"/>
> </foreign-key>
> </table>
>
> This should get the om.* classes generating correctly for you. On thing
> that I noticed is that the primary key of your KUNDE table is also the
> foreign key to AUDIOTEX_USER. Was this your intent? Perhaps you really
> just wanted to add a USER_ID column in the KUNDE table. If so, change
> the definition of the KUNDE table as follows.
>
> <table name="KUNDE">
> <column name="KUNDE_ID" primaryKey="true"
> required="true" type="INTEGER"/>
> <column name="USER_ID" required="true" type="INTEGER"/>
> <foreign-key foreignTable="AUDIOTEX_USER">
> <reference local="USER_ID" foreign="USER_ID"/>
> </foreign-key>
> </table>
>
> After making those changes, run the project-om task again. The only
> Turbine* or BaseTurbine* classes that you should have in your om package
> are TurbineUserAdapter and TurbineUserPeerAdapter. You should not have
> any Turbine* classes in the om.map package.
>
>
> Just FYI, here is the exact syntax from my schema file. The name of my
> extend turbine user class is called NeoUser. I added clientId as a
> column in TURBINE_USER.
>
> <table name="NEO_USER" alias="TurbineUser"
> baseClass="com.nequalsone.om.TurbineUserAdapter"
> basePeer="com.nequalsone.om.TurbineUserPeerAdapter">
> <column name="USER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> </table>
> <table name="ADDRESS">
> <column name="OBJECT_ID" primaryKey="true" required="true"
> type="INTEGER"/>
> <column name="LINE_1" size="40" type="VARCHAR"/>
> <column name="LINE_2" size="30" type="VARCHAR"/>
> <column name="CITY" size="30" type="VARCHAR"/>
> <column name="STATE" size="2" type="VARCHAR"/>
> <column name="ZIP_CODE" size="5" type="VARCHAR"/>
> <column name="ZIP_PLUS_4" size="4" type="VARCHAR"/>
> <column name="CLIENT_ID" required="true" type="INTEGER"/>
> <foreign-key foreignTable="CLIENT">
> <reference foreign="OBJECT_ID" local="CLIENT_ID"/>
> </foreign-key>
> </table>
>
> Please let me know if this helps.
>
>
> -----Original Message-----
> From: Marc Lustig [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 14, 2002 4:02 PM
> To: Turbine Users List
> Subject: AW: Documentation update
>
>
> Thanks, Quinton, that helped.
> However there is another problem: torque generates two classes in all of
> these files:
>
> BaseTurbineUser.java
> BaseTurbineUserPeer.java
> BaseTurbineUserManager.java
>
> For example, BaseTurbineUser.java contains both of these classes
>
> public abstract class BaseTurbineUser extends
> de.geoconnect.audiotex.om.TurbineUserAdapter
> implements org.apache.turbine.om.Retrievable
> and
> public abstract class BaseTurbineUser extends BaseObject
> implements org.apache.turbine.om.Retrievable
>
> Apparently what happens is that Torque generates object TurbineUser two
> times, first time from turbine-schema.xml, and second time from
> project-schema.xml.
>
>
> How did you got around this?
>
> My schema looks like this:
>
> <table name="TURBINE_USER" alias="AudiotexUser"
> baseClass="de.geoconnect.audiotex.om.TurbineUserAdapter"
> basePeer="de.geoconnect.audiotex.om.TurbineUserPeerAdapter">
> <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
> </table>
> <table name="KUNDE">
> <column name="KUNDE_ID" primaryKey="true"
> required="true" type="INTEGER"/>
> <foreign-key foreignTable="TURBINE_USER">
> <reference local="KUNDE_ID" foreign="USER_ID"/>
> </foreign-key>
> </table>
>
>
> Marc
>
>
>
> > -----Ursprungliche Nachricht-----
> > Von: Quinton McCombs [mailto:[EMAIL PROTECTED]]
> > Gesendet: Samstag, 14. Dezember 2002 22:25
> > An: 'Turbine Users List'
> > Betreff: RE: Documentation update
> >
> >
> > My applogies. It should have been getTitle(). This is the attribute
> > that, in the example, we are adding to Turbine User. Sorry, I guess
> > that was another reference that I over looked when converted the code
> > that I am using into the example.
> >
> > -----Original Message-----
> > From: Marc Lustig [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, December 14, 2002 2:16 PM
> > To: Turbine Users List
> > Subject: AW: Documentation update
> >
> >
> > Quinton, I tried out your Extend-User howto. I'm running into various
> > problems, but first of all: you have this method in your
> > TurbineMapBuilderAdapter
> >
> > public void doBuild() throws java.lang.Exception
> > {
> > super.doBuild();
> >
> > // Make dummy object - required for adding a column to the map
> > Integer integer = new Integer(0);
> >
> > // Add extra User columns.
> > TableMap tMap =
> > Torque.getDatabaseMap().getTable(getTableUser());
> > tMap.addColumn(getClientId(),integer);
> > ^^^^^^^^^^^^
> > }
> >
> > Problem is there is no method getCliendId() neither in
> > TurbineMapBuilderAdapter nor in
> > org.apache.turbine.util.db.map.TurbineMapBuilder.
> >
> > Could you please let me know how you implemented this method ? Thanks!
> >
> > Once, this is fixed all the other compilations errors might fade away.
> >
> > Marc
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>