Discussion:
[Middlegen-user] Problem with 2 column primary key both referencing other tables?
James Adams
2003-05-08 12:07:06 UTC
Permalink
Hello,

I have a table with a 2 column primary key where both columns of the key also reference different tables

TABLEA
-----------
bName references TABLEB(bName),
cName refrences TABLEB(cName),
primary key(Bname,Cname)


TABLEB
-------------
bName - primary key
someval


TABLEC
--------------
cName - primary key
someotherval


But I'm having problems when I try and add an element to table A.

It either says

java.sql.SQLException: ERROR: parser: parse error at end of input

or complains that I'm trying to add a null value to a NOT NULL column.

Has anyone else come across this? or know anything that may help me.

I'm using PostgreSQL with JBoss.

Thanks in advance

James
Gregory Joseph
2003-05-08 12:39:12 UTC
Permalink
You can have your TABLEA automatically handled/generated by jboss using
xdoclet's @jboss.relation-mapping style="relation-table", I think it makes it
much easier ;)
Then all you have to do is add/remove relations using the Collection from any
side of the relation

g

-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 15:55
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Problem with 2 column primary key both referencing
other tables?


Hello,

I have a table with a 2 column primary key where both columns of the key also
reference different tables

TABLEA
-----------
bName references TABLEB(bName),
cName refrences TABLEB(cName),
primary key(Bname,Cname)


TABLEB
-------------
bName - primary key
someval


TABLEC
--------------
cName - primary key
someotherval


But I'm having problems when I try and add an element to table A.

It either says

java.sql.SQLException: ERROR: parser: parse error at end of input

or complains that I'm trying to add a null value to a NOT NULL column.

Has anyone else come across this? or know anything that may help me.

I'm using PostgreSQL with JBoss.

Thanks in advance

James
James Adams
2003-05-08 13:17:11 UTC
Permalink
Hello,

Where do I add the @jboss.relation-mapping style="relation-table" you mention?

If its in the files generated by middlegen is there a way I get get middlegen to add it automatically so its not copied over if adjust the DB and call middlegen again?

J


----- Original Message -----
From: Gregory Joseph
To: middlegen-***@lists.sourceforge.net
Sent: Thursday, May 08, 2003 4:38 PM
Subject: RE: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


You can have your TABLEA automatically handled/generated by jboss using xdoclet's @jboss.relation-mapping style="relation-table", I think it makes it much easier ;)
Then all you have to do is add/remove relations using the Collection from any side of the relation

g
-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 15:55
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


Hello,

I have a table with a 2 column primary key where both columns of the key also reference different tables

TABLEA
-----------
bName references TABLEB(bName),
cName refrences TABLEB(cName),
primary key(Bname,Cname)


TABLEB
-------------
bName - primary key
someval


TABLEC
--------------
cName - primary key
someotherval


But I'm having problems when I try and add an element to table A.

It either says

java.sql.SQLException: ERROR: parser: parse error at end of input

or complains that I'm trying to add a null value to a NOT NULL column.

Has anyone else come across this? or know anything that may help me.

I'm using PostgreSQL with JBoss.

Thanks in advance

James
Gregory Joseph
2003-05-08 13:30:10 UTC
Permalink
Hmm. It's needed along other @*.relation* tags in the getXXXXs methods.
But afaik, you can't have middlegen do this for you. I personnaly used
middlegen in a one-shot way: 1st generate my beans from my db, then customize
my beans instead of continuing on working on the db itself

g

-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 17:16
To: middlegen-***@lists.sourceforge.net
Subject: Re: [Middlegen-user] Problem with 2 column primary key both
referencing other tables?


Hello,

Where do I add the @jboss.relation-mapping style="relation-table" you
mention?

If its in the files generated by middlegen is there a way I get get middlegen
to add it automatically so its not copied over if adjust the DB and call
middlegen again?

J



----- Original Message -----
From: Gregory <mailto:***@kiala.com> Joseph
To: middlegen-***@lists.sourceforge.net
Sent: Thursday, May 08, 2003 4:38 PM
Subject: RE: [Middlegen-user] Problem with 2 column primary key both
referencing other tables?

You can have your TABLEA automatically handled/generated by jboss using
xdoclet's @jboss.relation-mapping style="relation-table", I think it makes it
much easier ;)
Then all you have to do is add/remove relations using the Collection from any
side of the relation

g

-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 15:55
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Problem with 2 column primary key both referencing
other tables?


Hello,

I have a table with a 2 column primary key where both columns of the key also
reference different tables

TABLEA
-----------
bName references TABLEB(bName),
cName refrences TABLEB(cName),
primary key(Bname,Cname)


TABLEB
-------------
bName - primary key
someval


TABLEC
--------------
cName - primary key
someotherval


But I'm having problems when I try and add an element to table A.

It either says

java.sql.SQLException: ERROR: parser: parse error at end of input

or complains that I'm trying to add a null value to a NOT NULL column.

Has anyone else come across this? or know anything that may help me.

I'm using PostgreSQL with JBoss.

Thanks in advance

James
James Adams
2003-05-08 13:47:20 UTC
Permalink
Thats what I thought. I'll have a play around and decide which way to go.

Thanks for your help

J


----- Original Message -----
From: Gregory Joseph
To: middlegen-***@lists.sourceforge.net
Sent: Thursday, May 08, 2003 5:29 PM
Subject: RE: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


Hmm. It's needed along other @*.relation* tags in the getXXXXs methods.
But afaik, you can't have middlegen do this for you. I personnaly used middlegen in a one-shot way: 1st generate my beans from my db, then customize my beans instead of continuing on working on the db itself

g
-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 17:16
To: middlegen-***@lists.sourceforge.net
Subject: Re: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


Hello,

Where do I add the @jboss.relation-mapping style="relation-table" you mention?

If its in the files generated by middlegen is there a way I get get middlegen to add it automatically so its not copied over if adjust the DB and call middlegen again?

J


----- Original Message -----
From: Gregory Joseph
To: middlegen-***@lists.sourceforge.net
Sent: Thursday, May 08, 2003 4:38 PM
Subject: RE: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


You can have your TABLEA automatically handled/generated by jboss using xdoclet's @jboss.relation-mapping style="relation-table", I think it makes it much easier ;)
Then all you have to do is add/remove relations using the Collection from any side of the relation

g
-----Original Message-----
From: James Adams [mailto:***@hotmail.com]
Sent: jeudi 8 mai 2003 15:55
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Problem with 2 column primary key both referencing other tables?


Hello,

I have a table with a 2 column primary key where both columns of the key also reference different tables

TABLEA
-----------
bName references TABLEB(bName),
cName refrences TABLEB(cName),
primary key(Bname,Cname)


TABLEB
-------------
bName - primary key
someval


TABLEC
--------------
cName - primary key
someotherval


But I'm having problems when I try and add an element to table A.

It either says

java.sql.SQLException: ERROR: parser: parse error at end of input

or complains that I'm trying to add a null value to a NOT NULL column.

Has anyone else come across this? or know anything that may help me.

I'm using PostgreSQL with JBoss.

Thanks in advance

James

Loading...