Look at Scarab (scarab.tigris.org) for an example of using the alias
attribute with TurbineUser. It is a bit more complicated in that
TurbineUser and TurbineUserPeer are not generated by Torque and are
missing some methods.
Also, the an alias table entry will generate om/peer classes that will
extend the om/peer classes for the table referenced in the alias
attribute. The reason for doing this is that the references to the
table from the new schema will result in some additional methods that
are not present in the parent classes. Note that the alias feature is a
recent addition and therefore will probably require some modifications
to cover situations I have not encountered.
john mcnally
Gabriel Moreno wrote:
>
> My idea of removing the new generated TurbineUser and TurbineUserPeer doesn't
> work. Keeping them doesn't work either because:
> -TurbineUser doesn't have a getUserId method
> -TurbineUserPeer doesn't have a retrieveByPK method
>
> Should I add these methods to the generated BaseTurbineUser and TurbineUserPeer?
> Am I completely lost?
> Any help will be appreciated.
> Thanks,
>
> Gabriel
>
> Gabriel Moreno wrote:
>
> > I'm trying to use the alias feature. I have this in my project-schema.xml:
> >
> > <table name="TURBINE_USER" idMethod="idbroker"
> > alias="org.apache.turbine.om.security.TurbineUser">
> > <column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
> > </table>
> >
> > <table name="member" idMethod="idbroker">
> > <column name="id" type="NUMERIC" size="6" primaryKey="true" required="true"
> > autoIncrement="true"/>
> > <column name="address" type="VARCHAR" size="200" required="true"/>
> > <column name="turbine_user_id" type="INTEGER" required="true"/>
> > <foreign-key foreignTable="TURBINE_USER">
> > <reference local="turbine_user_id" foreign="USER_ID"/>
> > </foreign-key>
> > </table>
> >
> > The problem is that new TurbineUser and TurbineUserPeer classes are generated
> > in the application object model. I could fix this by removing them and adding:
> >
> > import org.apache.turbine.om.security.TurbineUser;
> > import org.apache.turbine.om.security.TurbineUserPeer;
> > to BaseMember so that it uses the right TurbineUser.
> >
> > Is there any way to do this without modifiying the generated code? (Perhaps
> > I'm not using alias in the right way or am missing some other parameter).
> >
> > Thanks,
> > Gabriel
> >
> > Jon Stevens wrote:
> >
> > > on 5/30/01 6:35 AM, "Leandro Saad" <[EMAIL PROTECTED]> wrote:
> > >
> > > > You have to define a table called TURBINE_USER in the same file you
> > > > defined
> > > > IDENTITIES. Just don't use *all* the SQL generated, but only the
> > > > portions that you are
> > > > interested in.
> > >
> > > Yup. John is working on improving this with the addition of the concept of
> > > "aliased" tables in the project-schema.xml file.
> > >
> > > -jon
> > >
> > > --
> > > If you come from a Perl or PHP background, JSP is a way to take
> > > your pain to new levels. --Anonymous
> > > <http://jakarta.apache.org/velocity/ymtd/ymtd.html>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Gabriel Moreno
> > [EMAIL PROTECTED]
> > MSE Graduate Student
> > Carnegie Mellon University
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> Gabriel Moreno
> [EMAIL PROTECTED]
> MSE Graduate Student
> Carnegie Mellon University
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]