Re: middlegen not auto-detecting relations in MySQL

José Manuel Molina Pascual <[email protected]>
Newsgroups gmane.comp.java.ejb.middlegen.user
Organization Stratesys Consulting
Message-ID <[email protected]>
Yeah, I agree, I had the same problem, wnadered through the MySQL
Manual and found that about InnoDB tables.

They work fine with middlegen.

http://www.webyog.com/

I found this GUI very useful to work with InnoDB tables, MyCC lacks (as
far as I know) utilities to manage relationships.

M.-Leander Reimer wrote:

Hey
Tim,

well mySQL itself is clueless about relations, you have to use the
InnoDB extension instead!!!!!

CU

Leander

Timothy Peter Cockle wrote:

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

--

firma

José Manuel Molina
Pascual

[email protected]

Stratesys Consulting

C/ Juan de Mena, 6

Madrid 28014

Tel (+34) 91 360 49 60
logo_stratesys.jpg (image/jpeg, 14.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.