> That looks like the way to go Fedor. I have another issue that I want to
> bring up at this point. Both Torque's use a type attribute for columns
with
> values like "INTEGER", "VARCHAR", "VARBINARY" etc. This ties a little too
> closely to (a specific variant of ) SQL for my liking,
Agree!
> Wouldn't it be better
> to use Java-like types, e.g. "int", "string", "date", etc.,
I would not say "Java-like" but simply "Java", since we may work with one DB
or another, but always with java. So I would simply use Java types.
> and then have
> separate mapping files for each db, e.g. for Oracle:
>
> <db-mapping db="Oracle">
> <types>
> <type name="int" db-name="NUMBER"/>
> ...
> </types>
> </db-mapping>
>
> Thoughts?
I think all DB specifics should go into DB adapters. We need to add methods
like getIntType() to DB interface, or maybe getSQLType(Class class) ?
> > > > Is there a way in Torque to handle foreign key like this:
> > > >
> > > > FOREIGN KEY (A, B) references TABLE2 (A, B)
> > > >
> > > > if yes, how should I describe it in XML schema?
> > > > Does it make sense to make Foreign keys entities on their own, not
> just
> > > > attributes? This would allow for more flexibility, because FKs
_are_
> > > > actually entities...
> > > >
> > > >Opinions?
> > > >
> > > >fedor.
> > >
> > >In newtorque foreign keys are only allowed to be one column, but it
can
> > >reference a different column in the foreign table. That is FOREIGN
KEY
> (A)
> > >references TABLE2 (B). This is about as far as the flexibility goes
at
> the
> > >moment.
> > >
> > >Maybe you can think of a nice way of representing this in the xml
> > >schema file.
> >
> > I think the way to do it is to think of Foreign keys as entities. They
> > actually are entities - look at DB diagrams. They have attributes which
> > probably constitutes an entity.
> >
> > so thing like
> > cREATE TABLE TABLE1 (
> > ...
> > ...
> > FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D)
> > )
> >
> > would look like this in XML schema:
> >
> > <table name='TABLE1'>
> > ...
> > </table>
> > <table name='TABLE2'>
> > ...
> > </table>
> > <foreign-key name='...'>
> > <primary-key-table name='TABLE2'>
> > <column name='C'/>
> > <column name='D'/>
> > </primary-key-table>
> > <foreign-key-table name='TABLE1'>
> > <column name='A'/>
> > <column name='B'/>
> > </foreign-key-table>
> > </foreign-key>
> >
> > Not sure about the names (as always), but you got the idea...
> >
> > >We'll also need to be able to add this to MapBuilder
> > >so that Peers are aware of multi-column foreign keys.
> >
> > sure.
> >
> > fedor.
> >
> >
> >
> >
> >
> > _______________________________________________________
> > Say Bye to Slow Internet!
> > http://www.home.com/xinbox/signup.html
> >
> >
> >
> > ------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> > Problems?: [EMAIL PROTECTED]
> >
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
fedor.
_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]