Re: MySQL Foreign Key and EOModel Relationships

From: Kieran Kelleher (kieran_list..ac.com)
Date: Mon Mar 17 2008 - 16:58:05 EDT

  • Next message: Michael Hast: "WOLips webobject tag auto-complete spaces"

    Like I said, EOF and the EOModel will take care of foreign keys, etc.

    Check your syntax in the online MySQL manual. That is what I go by.
    Also, I let EOF and the EOModel dictate the cascade rules, etc. In
    reality, WebObjects takes care of a lot of the details since it works
    with most basic ANSI SQL 92. Just define tables, columns and primary
    keys in MySQL. Let WebObjects and EOF take care of all the other
    logic ... relationships, cascade deletes, etc.

    http://dev.mysql.com/doc/refman/5.0/en/index.html

    On Mar 17, 2008, at 3:47 PM, Gustavo Pizano wrote:

    > Well im not good at SQL, i have to remeber a lot form my studies, I
    > almost forgot the principles. but this is what I have
    >
    > <Picture 1.png>
    > now, in mysql I generated with MySQL Administrator the tables
    > putting as PK in Aspirante the atribute 'documento' and this at the
    > same time is the FK to the table
    > DetallesXAspirante.docuemento_Aspirante.
    >
    > I guess the model its fine.. in EOModel
    >
    > just wondering when I was making the tables in MySQL I putted
    > another name to the foreign key I did this
    >
    > ALTER TABLE `Convocatoria`.`Aspirante` ADD CONSTRAINT `fkAspirante`
    > FOREIGN KEY `fkAspirante` (`documento`)
    > REFERENCES `DetallesXAspirante` (`documento_Aspirante`)
    > ON DELETE RESTRICT
    > ON UPDATE CASCADE;
    >
    > and the SQL generator (which doesn't work) in EOModeler will give
    > something like this
    > ALTER TABLE Aspirante ADD CONSTRAINT Aspirante_detallesXAspirante_FK
    > FOREIGN KEY (documento) REFERENCES DetallesXAspirante
    > (documento_Aspirante);
    >
    > I realize then that maybe I will have problem with the names no?
    > should I change the RElationShip name in EOModel from
    > detallesXAspirante to something what I put in MySQL command ?? just
    > to ensuere I will have no problems when mapping.??
    >
    > Thanks
    > Gus
    >
    >
    >> Yo ; u can work directly in MySQL. All that is important is that
    >> the tables/columns defined in the EOModel exist in the database.
    >> There is no "relationships" defined in MySQL ...... just tables and
    >> columns ....... the relationships are defined in the EOModel.
    >>
    >> Also make sure you use innodb as the default table type, not MyISAM.
    >>
    >>
    >> On Mar 17, 2008, at 12:48 PM, Gustavo Pizano wrote:
    >>
    >>> will I have any problems if I create the database direct in
    >>> Mysql, or with MySql Administrator, and then due that it has
    >>> relationships, will the EO have problems accesing the database and
    >>> the records?
    >>>
    >>> Gus
    >>>
    >>>
    >>> On Mar 17, 2008, at 11:20 AM, Mike Schrag wrote:
    >>>
    >>>> If you're using WO 5.4, Pierre posted on the mailing list a
    >>>> couple days ago that there's a bug in 5.4 that causes SQL to not
    >>>> generate properly through the API that Entity Modeler uses.
    >>>>
    >>>> ms
    >>>>
    >>>> On Mar 17, 2008, at 12:02 PM, Gustavo Pizano wrote:
    >>>>
    >>>>>
    >>>>> Oki fixed the problem it was an error in the url.. but now the
    >>>>> Generated SQL doesn't correspont to a MySQL statements.
    >>>>> so.. should i do them manually?
    >>>>>
    >>>>>
    >>>>> Gus
    >>>>>
    >>>>> On Mar 17, 2008, at 10:34 AM, Gustavo Pizano wrote:
    >>>>>
    >>>>>> Hello Well im tryin to conect generate a MySql, but it says
    >>>>>> that driver not found o somehtign like that, I did what this
    >>>>>> page shows http://wiki.objectstyle.org/confluence/download/attachments/197096/JDBC_correct_settings_mysql.jpg?version=1
    >>>>>> but I guess i have something diferent.. I downloaded the
    >>>>>> jconnector 5.1 from the Mysql Page, I was following these
    >>>>>> instructions http://homepage.mac.com/kelleherk/iblog/C711669388/E20070719095201/index.html
    >>>>>>
    >>>>>> so what can I do?
    >>>>>>
    >>>>>> Thanks
    >>>>>> Gus
    >>>>>>
    >>>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Mon Mar 17 2008 - 16:59:47 EDT