Discussion:
[Middlegen-user] 1:1 MAPPING
James Adams
2003-04-23 09:41:42 UTC
Permalink
Hello,

First of all thanks to all those involved with the developmemt of Middlegen its a fantastic tool.


My Problem;

I have 2 tables a "usertable" with "username" as the primary key and an "othertable" that has also has a primary key of username and references usertable(username). This is a 1:1 mapping.

When I try and access the "usertable" entity bean created by Middlegen I get an 'attribute "othertable" not found' ERROR.

Can anyone help me as to why this is. It works fine if I set up "othertable" with no primary key so as to be a 1 to many relationship.

I'm using postgres 7.3.2 as the datasource with the middlegen supplied JDBC driver on JBoss 3.2RC2

thanks in advance

James


My tables are

Table : usertable
------------------------------
username varchar(20) primary key
name varchar(15)

Table : othertable
--------------------------
username varchar(20) primary key references usertable(username)
anotherval varchar(10)

In middlegen its set as a 1:1 bi directional relationship.
a***@netcom.no
2003-04-23 13:10:03 UTC
Permalink
Hi James,

Could you post a bug report please? (Even though I'm not sure this is a
bug). That way we won't forget to look at it.

Aslak

----- Original Message -----
From: "James Adams" <***@hotmail.com>
Date: Wednesday, April 23, 2003 12:23 pm
Subject: [Middlegen-user] 1:1 MAPPING
Post by James Adams
Hello,
First of all thanks to all those involved with the developmemt of
Middlegen its a fantastic tool.
My Problem;
I have 2 tables a "usertable" with "username" as the primary key
and an "othertable" that has also has a primary key of username
and references usertable(username). This is a 1:1 mapping.
When I try and access the "usertable" entity bean created by
Middlegen I get an 'attribute "othertable" not found' ERROR.
Can anyone help me as to why this is. It works fine if I set up
"othertable" with no primary key so as to be a 1 to many relationship.
I'm using postgres 7.3.2 as the datasource with the middlegen
supplied JDBC driver on JBoss 3.2RC2
thanks in advance
James
My tables are
Table : usertable
------------------------------
username varchar(20) primary key
name varchar(15)
Table : othertable
--------------------------
username varchar(20) primary key references usertable(username)
anotherval varchar(10)
In middlegen its set as a 1:1 bi directional relationship.
M.-Leander Reimer
2003-04-23 14:34:08 UTC
Permalink
Hi James,



did JBoss create the tables or have you created them manually. I think I
once had a similar problem, and the problem was that there needs

to be a foreign key definition in each of the tables in order to model a bi
directional 1:1 relationship (well at least JBoss wants it this way).



Let JBoss create the tables and have a look at them.



Hope that helps.



Leander





-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net] Im Auftrag von James
Adams
Gesendet: Mittwoch, 23. April 2003 13:24
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] 1:1 MAPPING



Hello,



First of all thanks to all those involved with the developmemt of Middlegen
its a fantastic tool.





My Problem;



I have 2 tables a "usertable" with "username" as the primary key and an
"othertable" that has also has a primary key of username and references
usertable(username). This is a 1:1 mapping.



When I try and access the "usertable" entity bean created by Middlegen I get
an 'attribute "othertable" not found' ERROR.



Can anyone help me as to why this is. It works fine if I set up
"othertable" with no primary key so as to be a 1 to many relationship.



I'm using postgres 7.3.2 as the datasource with the middlegen supplied JDBC
driver on JBoss 3.2RC2



thanks in advance



James





My tables are



Table : usertable

------------------------------

username varchar(20) primary key

name varchar(15)



Table : othertable

--------------------------

username varchar(20) primary key references usertable(username)

anotherval varchar(10)



In middlegen its set as a 1:1 bi directional relationship.
James Adams
2003-04-24 21:59:01 UTC
Permalink
Hello

Yea you're right. When allowing JBoss to create the tables the "usertable" it creates has an "othertable" attribute in it.

Oh well if thats the way JBoss wants it.

I haven't filed this as a Middlegen bug as its not really a bug.

Many thanks

James







----- Original Message -----
From: M.-Leander Reimer
To: middlegen-***@lists.sourceforge.net
Sent: Wednesday, April 23, 2003 6:34 PM
Subject: AW: [Middlegen-user] 1:1 MAPPING


Hi James,



did JBoss create the tables or have you created them manually. I think I once had a similar problem, and the problem was that there needs

to be a foreign key definition in each of the tables in order to model a bi directional 1:1 relationship (well at least JBoss wants it this way).



Let JBoss create the tables and have a look at them.



Hope that helps.



Leander





-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net [mailto:middlegen-user-***@lists.sourceforge.net] Im Auftrag von James Adams
Gesendet: Mittwoch, 23. April 2003 13:24
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] 1:1 MAPPING



Hello,



First of all thanks to all those involved with the developmemt of Middlegen its a fantastic tool.





My Problem;



I have 2 tables a "usertable" with "username" as the primary key and an "othertable" that has also has a primary key of username and references usertable(username). This is a 1:1 mapping.



When I try and access the "usertable" entity bean created by Middlegen I get an 'attribute "othertable" not found' ERROR.



Can anyone help me as to why this is. It works fine if I set up "othertable" with no primary key so as to be a 1 to many relationship.



I'm using postgres 7.3.2 as the datasource with the middlegen supplied JDBC driver on JBoss 3.2RC2



thanks in advance



James





My tables are



Table : usertable

------------------------------

username varchar(20) primary key

name varchar(15)



Table : othertable

--------------------------

username varchar(20) primary key references usertable(username)

anotherval varchar(10)



In middlegen its set as a 1:1 bi directional relationship.
James Adams
2003-04-25 12:29:02 UTC
Permalink
Hello again,

On closer inspection I'm sure somthing isn't quite right here.

If I allow user Jboss to create the tables from ejb-definitions generated by Middlegen then it all works fine. But if I then feed those generated schema back into Middlegen the code generation fails as it trys to create 2 functions of the same name in the usertable bean, one to access the reference to "othertable" and one to access the newly added column called "othertable".

Alternatively if I generate the code from the original db schema then add another column to my usertable before deploying to JBoss all works well but the same thing happens when I then try and generate ejbs from the new schema. This obviously causes the convieniant development process that Middlegen provides to break down.

I added a bug report after all entitled "1:1 mapping for JBoss"

regards

James




----- Original Message -----
From: James Adams
To: middlegen-***@lists.sourceforge.net
Sent: Friday, April 25, 2003 1:50 AM
Subject: Re: [Middlegen-user] 1:1 MAPPING


Hello

Yea you're right. When allowing JBoss to create the tables the "usertable" it creates has an "othertable" attribute in it.

Oh well if thats the way JBoss wants it.

I haven't filed this as a Middlegen bug as its not really a bug.

Many thanks

James







----- Original Message -----
From: M.-Leander Reimer
To: middlegen-***@lists.sourceforge.net
Sent: Wednesday, April 23, 2003 6:34 PM
Subject: AW: [Middlegen-user] 1:1 MAPPING


Hi James,



did JBoss create the tables or have you created them manually. I think I once had a similar problem, and the problem was that there needs

to be a foreign key definition in each of the tables in order to model a bi directional 1:1 relationship (well at least JBoss wants it this way).



Let JBoss create the tables and have a look at them.



Hope that helps.



Leander





-----Ursprüngliche Nachricht-----
Von: middlegen-user-***@lists.sourceforge.net [mailto:middlegen-user-***@lists.sourceforge.net] Im Auftrag von James Adams
Gesendet: Mittwoch, 23. April 2003 13:24
An: middlegen-***@lists.sourceforge.net
Betreff: [Middlegen-user] 1:1 MAPPING



Hello,



First of all thanks to all those involved with the developmemt of Middlegen its a fantastic tool.





My Problem;



I have 2 tables a "usertable" with "username" as the primary key and an "othertable" that has also has a primary key of username and references usertable(username). This is a 1:1 mapping.



When I try and access the "usertable" entity bean created by Middlegen I get an 'attribute "othertable" not found' ERROR.



Can anyone help me as to why this is. It works fine if I set up "othertable" with no primary key so as to be a 1 to many relationship.



I'm using postgres 7.3.2 as the datasource with the middlegen supplied JDBC driver on JBoss 3.2RC2



thanks in advance



James





My tables are



Table : usertable

------------------------------

username varchar(20) primary key

name varchar(15)



Table : othertable

--------------------------

username varchar(20) primary key references usertable(username)

anotherval varchar(10)



In middlegen its set as a 1:1 bi directional relationship.

Loading...