Hi!

Your problem should be fixed now. Details below.

Aslak

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of David
> Nouls
> Sent: 30. august 2002 11:07
> To: M-Leander Reimer
> Cc: Middlegen Users Mailing List
> Subject: RE: [Middlegen-user] Howto disable CMR ?
>
>
> Hi Leander,
>
> No, that didn't help. I still get the same error message.
> If I look to the samples of middlegen I see no example where they name
> the relations. They never reference the same table more than once.
>

The error message is misleading. Naming the relations won't help.

> This is rather stupid that the middlegen task just stops. The foreign
> keynames are different so it should be no problem to differentiate the
> relations.
>

Should be fixed now. If you're interested in the inner workings, read on.

A foreign key is not the same as a foreign key column. In fact, a foreign
key is a set of one or more foreign key columns. In most cases a foreign key
consists of only one foreign key column, so people tend to mix them
up. -Even the people who write JDBC drivers.

So what does the name of a foreign key mean? Well, it's just a logical name.
This name can be used to figure out to what foreign key a certain foreign
key column belongs to. This is needed when there are more than one relation
between 2 tables. In your scenario, we need to know whether the two foreign
key columns belong to the same logical key or whether it is two distinct
foreign keys with only one column.

Middlegen uses the key name (FK_NAME) to figure that out. The mm.mysql JDBC
driver reports null for FK_NAME, so it panics because it can't figure it
out.

I have just committed updated code that can do without this FK_NAME, which
many drivers report to be null. The new approach is to use KEY_SEQ. Look in
MiddlegenPopulator.addRelations(...) if you're interested.

> The whole joke is ofcourse that I only need CMP and not CMR! I never use
> finders
> since I can get a speed x3 when I use a DAO approach. EJB QL is a
> nice idea,
> but
> needs a few more revision to make it useful for real applications.
>
> I'm also deploying on JBOSS 3.0.1 so that means I can not have
> foreign keys
> that
> are part of a relation (every one of them). But I don't want to call into
> the
> Local object of a relation to just get the id!
>
> /)avid
>
> > -----Original Message-----
> > From: M-Leander Reimer [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 30, 2002 10:44 AM
> > To: David Nouls
> > Subject: RE: [Middlegen-user] Howto disable CMR ?
> >
> >
> > Hi David,
> >
> > I think the problem is that you define your foreign keys with the ALTER
> > TABLE style. This does not work work mySql for some reason.
> >
> > Try to define the foreign keys in the CREATE TABLE definition, as its
> > done in the middlegen samples.
> >
> > Worked for me (and I am using the same configuration as you do :-))
> >
> > Hope it helps.
> >
> > Leander
> >
> >
> > Am Fre, 2002-08-30 um 10.47 schrieb David Nouls:
> > > Also note: I give the foreign keys a unique name in the table
> fieldname.
> > >
> > > /)avid
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED]]On
> Behalf Of David
> > > > Nouls
> > > > Sent: Friday, August 30, 2002 10:36 AM
> > > > To: Middlegen Users Mailing List
> > > > Subject: [Middlegen-user] Howto disable CMR ?
> > > >
> > > >
> > > > Hello,
> > > >
> > > > Is there a way to disable the CMR detection of Middlegen ?
> > > > I always get the following error:
> > > >
> > > >
> > > > BUILD FAILED
> > > > file:C:/Dev/project/build.xml:204:
> > middlegen.MiddlegenException: There is
> > > > more
> > > >  than one relation between bug and person, but the JDBC
> > driver or database
> > > > doesn
> > > > 't seem to provide any names for the relationships. It is therefore
> > > > impossible f
> > > > or Middlegen to determine what foreign keys participate in what
> > > > relationships. Y
> > > > ou should try a different JDBC driver or reduce the number of
> > relations to
> > > > one.
> > > > You can also try to explicitly name the relations in the database.
> > > > DatabaseMetad
> > > > ata.getCrossReference(...).getString("FK_NAME") + returned null!
> > > >
> > > >
> > > > I'm using the MySql driver that is used in the samples. I
> > tried with other
> > > > versions
> > > > of the driver as well, yet I don't seem to be able to get the
> > relations
> > > > working
> > > > correctly.
> > > >
> > > > I don't realy need the CMR stuff anyway, so I don't want to
> > > > invest too much
> > > > time
> > > > in getting them to work.
> > > >
> > > > Any ideas ?
> > > > - I'm using MySQL (latest 3.x release) MAX with InnoDB enabled
> > > > - Java 1.3
> > > > - Jboss 3.0.1 with CMP.
> > > >
> > > > (No i'm not switching to a better database, MySQL is just fine
> > > > for what I'm
> > > > doing
> > > > it is more stable and faster than PostgresSQL).
> > > >
> > > > The create.sql that I use has the following foreign keys defined:
> > > > ALTER TABLE BUG
> > > > ADD CONSTRAINT FK_PERSON_BUG_1
> > > > FOREIGN KEY (idAssignedTo) REFERENCES PERSON (idPerson);
> > > >
> > > > ALTER TABLE BUG
> > > > ADD CONSTRAINT FK_PERSON_BUG_8
> > > > FOREIGN KEY (idReportedBy) REFERENCES PERSON (idPerson)
> > > > ;
> > > >
> > > > So, as you can see: i do specify the names of the relations,
> > but these are
> > > > not returned
> > > > by the JDBC driver. (I know the names stink but my
> generator makes the
> > > > scripts for me,
> > > > in de design tool I set the names correctly).
> > > >
> > > > /)avid
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This sf.net email is sponsored by: OSDN - Tired of that same old
> > > > cell phone?  Get a new here for FREE!
> > > > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> > > > _______________________________________________
> > > > middlegen-user mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/middlegen-user
> > > >
> > > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by: OSDN - Tired of that same old
> > > cell phone?  Get a new here for FREE!
> > > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> > > _______________________________________________
> > > middlegen-user mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/middlegen-user
> > --
> > M.-Leander Reimer
> > Dipl.-Inf. (FH)
> >
> > Techdivision
> > Kunstm�hlstr. 17
> > 83022 Rosenheim
> >
> > Fon:        (08031) 356 38 32
> > Fax:        (08031) 356 38 48
> > Mail:       [EMAIL PROTECTED]
> >
> >
> >
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone?  Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> middlegen-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
middlegen-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to