Discussion:
[Middlegen-user] Using Middlegen with Jboss (1:N relations)?
Darren Hartford
2003-12-08 18:13:03 UTC
Permalink
Hey all,
Been testing Middlegen on and off, and now have a project that is perfect for MiddleGen where I have an existing database that will be used to setup EJB's. Unfortunately, for the life of me I can not get MiddleGen to generate Entity Bean classes (EJB2/CMP2) based on tables with 1:N relations that will deploy correctly on JBoss.

"Both roles of a relation-table mapped relationship must have key fields"

This is a consistent error with JBoss 3.2.2, 3.2.3, 4.0DR2 on MiddleGen-2.0-b1. I did try to run MiddleGen CVS/2.0-b2 but the CMP20 plugin is broken as far as I could tell.

I have tested with FKCMP equals true and equals false (although my preference is to 'true' since that is how the existing table is layed out).

CMP section of the ant/maven task:
<cmp20
destination="${basedir}/generated/middlegen"
package="${pom.package}.domain.ejb"
interfacepackage="${pom.package}.domain.interfaces"
readonly="false"
fkcmp="true"
<jboss/>
</cmp20>

The database is MS SQL Server (not my choice) and using M$ JDBC drivers with great success (better results than jTDS).

Any help please? Saying this is urgent is pointless, I know, but was hoping MiddleGen could sweep in for the win!

-D
Eivind Waaler
2003-12-08 22:09:41 UTC
Permalink
Hi Darren.

Could you detail out your problem some more? I just tested with the latest
cvs version locally, and I can build and deploy the airline sample fine
with relationships on JBoss.

I'm using JBoss 3.2.1 with mySQL 4.0.12.

What is the problem you get when running the latest Middlegen? Maybe you
could try to run a small database with the Middlegen sample tables or
something just to see if the problem is related to your database
configuration..?

Are you sure Middlegen is running fine? Do you see the relationships in
the gui when you open this? Maybe you could try running a standard
Middlegen with the hsqldb just to have some files to compare? If we find
out what's missing from your files it might be easier to id the problem.

I'll try to help you out, if you can provide some more information that
would be good.

Regards
.eivind
Post by Darren Hartford
Hey all,
Been testing Middlegen on and off, and now have a project that is perfect for MiddleGen where I have an existing database that will be used to setup EJB's. Unfortunately, for the life of me I can not get MiddleGen to generate Entity Bean classes (EJB2/CMP2) based on tables with 1:N relations that will deploy correctly on JBoss.
"Both roles of a relation-table mapped relationship must have key fields"
This is a consistent error with JBoss 3.2.2, 3.2.3, 4.0DR2 on MiddleGen-2.0-b1. I did try to run MiddleGen CVS/2.0-b2 but the CMP20 plugin is broken as far as I could tell.
I have tested with FKCMP equals true and equals false (although my preference is to 'true' since that is how the existing table is layed out).
<cmp20
destination="${basedir}/generated/middlegen"
package="${pom.package}.domain.ejb"
interfacepackage="${pom.package}.domain.interfaces"
readonly="false"
fkcmp="true"
<jboss/>
</cmp20>
The database is MS SQL Server (not my choice) and using M$ JDBC drivers with great success (better results than jTDS).
Any help please? Saying this is urgent is pointless, I know, but was hoping MiddleGen could sweep in for the win!
-D
---------------
Darren Hartford
2003-12-09 13:36:03 UTC
Permalink
Hi Eivind,
This previous issue has been resolved. It was actually not related to MiddleGen at all, but rather after looking more closely at the tables given to me I found out one of the tables on an N relationship did NOT have any primary/compound keys at all. Once setup with a primary/compound key, MiddleGen rocked the house.

Good FYI for anyone having similar issues, check for PK's if you did not create/own the database!

--__--__--

Message: 2
Date: Tue, 9 Dec 2003 01:07:15 +0100 (CET)
From: Eivind Waaler <***@tihlde.org>
Subject: Re: [Middlegen-user] Using Middlegen with Jboss (1:N relations)?

Hi Darren.

Could you detail out your problem some more? I just tested with the latest
cvs version locally, and I can build and deploy the airline sample fine
with relationships on JBoss.

I'm using JBoss 3.2.1 with mySQL 4.0.12.

What is the problem you get when running the latest Middlegen? Maybe you
could try to run a small database with the Middlegen sample tables or
something just to see if the problem is related to your database
configuration..?

Are you sure Middlegen is running fine? Do you see the relationships in
the gui when you open this? Maybe you could try running a standard
Middlegen with the hsqldb just to have some files to compare? If we find
out what's missing from your files it might be easier to id the problem.

I'll try to help you out, if you can provide some more information that
would be good.

Regards
.eivind

Loading...