Thanks for the quick reply I will look into it.
Tim
On Thu, 2003-11-13 at 11:06, Markus H�rnvi wrote:
> Hi!
>
> Isn't MySQL clueless about relations? Use PostgreSQL instead perhaps?
>
>
> > Hi,
> >
> > Does any one else have a problem using MySQL with middlegen?
> >
> > The relationships are not being detected automatically. I guess I can be
> > the only one.
> >
> > Any help greatly appreicated even if it is a simple "It worked fine for
> > me!"
> >
> > I create the tables as below:
> >
> > DROP TABLE IF EXISTS person;
> > DROP TABLE IF EXISTS information;
> > DROP TABLE IF EXISTS relationship_type;
> > DROP TABLE IF EXISTS person_relationship;
> > DROP TABLE IF EXISTS diary;
> > DROP TABLE IF EXISTS form;
> > DROP TABLE IF EXISTS part;
> > DROP TABLE IF EXISTS question;
> > DROP TABLE IF EXISTS form_response;
> > DROP TABLE IF EXISTS wizard;
> > DROP TABLE IF EXISTS information_request;
> >
> > CREATE TABLE person(
> > person_id INT NOT NULL,
> > //CMP Fields remove to save space
> > PRIMARY KEY( person_id )
> > );
> >
> > CREATE TABLE information(
> > information_id INT NOT NULL,
> > type VARCHAR(255) NOT NULL,
> > information VARCHAR(255) NOT NULL,
> > person_id_fk INT,
> > PRIMARY KEY( information_id ),
> > FOREIGN KEY (person_id_fk) REFERENCES person(person_id)
> > );
> >
> >
> > CREATE TABLE relationship_type(
> > relationship_type_id INT NOT NULL,
> > type VARCHAR(255) NOT NULL,
> > PRIMARY KEY( relationship_type_id )
> > );
> >
> >
> > CREATE TABLE person_relationship (
> > person_relationship_id INT NOT NULL,
> > person_id_fk INT,
> > relationship_type_id_fk INT,
> > PRIMARY KEY(person_relationship_id),
> > FOREIGN KEY (person_id_fk) REFERENCES person(person_id),
> > FOREIGN KEY (relationship_type_id_fk) REFERENCES
> > relationship_type(relationship_type_id)
> > );
> >
> >
> >
> > CREATE TABLE diary(
> > diary_id INT NOT NULL,
> > //CMP Fields remove to save space
> > person_id_fk INT,
> > PRIMARY KEY(diary_id),
> > FOREIGN KEY (person_id_fk) REFERENCES person(person_id)
> > );
> >
> >
> >
> > And run middlegen like this:
> >
> > <!-- For the Person Entities -->
> > <middlegen
> > appname="${name}"
> > prefsdir="${src.dir}"
> > gui="${gui}"
> > databaseurl="${database.url}"
> > initialContextFactory="${java.naming.factory.initial}"
> > providerURL="${java.naming.provider.url}"
> > datasourceJNDIName="${databaseSource}"
> > driver="${database.driver}"
> > username="${database.userid}"
> > password="${database.password}"
> > schema=""
> > >
> >
> > <!-- Define Relationships -->
> >
> >
> > <many2many>
> > <tablea name="person">
> > <!-- <crossref fktable="person_relationship"
> > fkcolumn="person_id_fk"/> -->
> > </tablea>
> > <jointable name="person_relationship"
> > generate="false"/>
> > <!-- <jointable name="person_relationship"/> -->
> > <tableb name="relationship_type">
> > <!-- <crossref fktable="person_relationship"
> > fkcolumn="relationship_type_id_fk"/> -->
> > </tableb>
> > </many2many>
> > <!--
> > <table name="information"/>
> > <table name="relationship_type">
> > <crossref fktable="person_relationship"
> > fkcolumn="relationship_type_id_fk"/>
> > </table>
> > <table name="diary"/>
> > <table name="person">
> > <crossref fktable="information"
> > fkcolumn="person_id_fk"/>
> > <crossref fktable="diary"
> > fkcolumn="person_id_fk"/>
> > <crossref fktable="person_relationship"
> > fkcolumn="person_id_fk"/>
> > </table>
> > <table name ="person_relationship">
> > </table>
> > -->
> > <!-- Let Middlegen find Relationships -->
> > <table name="information"/>
> > <table name="relationship_type"/>
> > <table name="diary"/>
> > <table name="person"/>
> > <!-- <table name="person_relationship"/> -->
> >
> > <cmp20
> > destination="${build.gen-src.dir}"
> > package="alpha.personEntities"
> > interfacepackage="alpha.personEntitiesInterfaces"
> > jndiprefix="${unique.name}"
> > pkclass="false"
> > dataobject="false"
> > viewtype="local"
> > mergedir="${basedir}/src/middlegen"
> > readonly="false"
> > fkcmp="false"
> > guid="true"
> > >
> >
> > <sequenceblock
> > blocksize="5"
> > retrycount="2"
> > table="SEQ_BLOCK"
> > package="alpha.miscEntities"
> > interfacepackage="alpha.miscEntitiesInterfaces"
> > />
> >
> > <jboss/>
> > </cmp20>
> > </middlegen>
> >
> >
> > Cheers,
> >
> > Tim
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email sponsored by: ApacheCon 2003,
> > 16-19 November in Las Vegas. Learn firsthand the latest
> > developments in Apache, PHP, Perl, XML, Java, MySQL,
> > WebDAV, and more! http://www.apachecon.com/
> > _______________________________________________
> > middlegen-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/middlegen-user
> >
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: ApacheCon 2003,
> 16-19 November in Las Vegas. Learn firsthand the latest
> developments in Apache, PHP, Perl, XML, Java, MySQL,
> WebDAV, and more! http://www.apachecon.com/
> _______________________________________________
> middlegen-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
middlegen-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/middlegen-user