Discussion:
[Middlegen-user] mssql 2000 jdbc driver
w***@edge.net
2002-12-03 20:47:01 UTC
Permalink
Hi,

I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence table-name="contacts",
I get @ejb.persistence table-name="dbo.contacts". This results in syntax
errors which abort the deployment.

I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I didn't
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed, I'll submit
it as a patch.

Thanks,
Scott


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
Aslak Hellesøy
2002-12-03 21:33:02 UTC
Permalink
-----Original Message-----
Sent: 3. desember 2002 23:46
Subject: [Middlegen-user] mssql 2000 jdbc driver
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence table-name="contacts",
errors which abort the deployment.
We added the schema name because some ejb container (or was it jdbc driver?)
required the schema name to _be_ present.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I didn't
Currently there is no such option. Your patch to make this optional is most
welcome.
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed, I'll submit
it as a patch.
Thanks,
Scott
Cheers,
Aslak
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Rod Macpherson
2002-12-03 22:22:04 UTC
Permalink
The schema is normally implicit when logging in as an oracle user so it is surprising that a schema name is required in middlegen but it is definitely required. The problem is that when you deploy under JBoss the schema qualifier causes a failure. I solved this by filtering jbosscmp-jdbc.xml to remove the schema prefix on table-name elements and that worked fine. So you need the schema to generate the code but you have to filter it out before you deploy to JBoss. That seems to be the situation with oracle/jboss at least. Sounds like a possible JBoss error?

-----Original Message-----
From: Aslak HellesÞy [mailto:***@netcom.no]
Sent: Tue 12/3/2002 3:32 PM
To: ***@edge.net; middlegen-***@lists.sourceforge.net
Cc:
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
-----Original Message-----
Sent: 3. desember 2002 23:46
Subject: [Middlegen-user] mssql 2000 jdbc driver
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence table-name="contacts",
errors which abort the deployment.
We added the schema name because some ejb container (or was it jdbc driver?)
required the schema name to _be_ present.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I didn't
Currently there is no such option. Your patch to make this optional is most
welcome.
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed, I'll submit
it as a patch.
Thanks,
Scott
Cheers,
Aslak
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
middlegen-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Hal Deadman
2002-12-03 22:36:06 UTC
Permalink
RE: [Middlegen-user] mssql 2000 jdbc driverI always thought it was bad form to fully qualify a table name with the schema in application code. It makes having multiple environments (dev/test) in a single database instance difficult. It also prevents re-direction via synonyms if you are trying to redirect a query to a different table transparent to the application. I was suprised to see the schema prefix on the tablename as the default. It's not a big deal but a patch would definately make sense, and the default should probably be to leave off the schema.

-----Original Message-----
From: middlegen-user-***@lists.sourceforge.net [mailto:middlegen-user-***@lists.sourceforge.net]On Behalf Of Rod Macpherson
Sent: Tuesday, December 03, 2002 7:22 PM
To: Aslak HellesÞy; ***@edge.net; middlegen-***@lists.sourceforge.net
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver


The schema is normally implicit when logging in as an oracle user so it is surprising that a schema name is required in middlegen but it is definitely required. The problem is that when you deploy under JBoss the schema qualifier causes a failure. I solved this by filtering jbosscmp-jdbc.xml to remove the schema prefix on table-name elements and that worked fine. So you need the schema to generate the code but you have to filter it out before you deploy to JBoss. That seems to be the situation with oracle/jboss at least. Sounds like a possible JBoss error?

-----Original Message-----
From: Aslak HellesÞy [mailto:***@netcom.no]
Sent: Tue 12/3/2002 3:32 PM
To: ***@edge.net; middlegen-***@lists.sourceforge.net
Cc:
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
-----Original Message-----
Sent: 3. desember 2002 23:46
Subject: [Middlegen-user] mssql 2000 jdbc driver
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence table-name="contacts",
errors which abort the deployment.
We added the schema name because some ejb container (or was it jdbc driver?)
required the schema name to _be_ present.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I didn't
Currently there is no such option. Your patch to make this optional is most
welcome.
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed, I'll submit
it as a patch.
Thanks,
Scott
Cheers,
Aslak
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
middlegen-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Aslak Hellesøy
2002-12-03 22:44:02 UTC
Permalink
I guess that while calling "regular" JDBC methods the schema name is implicit, but in the various methods in DatabaseMetadata it's not. -Probably because you might be logged in as one user/schema, but still might want to look at the structure (=metadata) for other schemas. So schema name is (and this is a guess) _not_ implicit when dealing with the DatabaseMetadata methods. -And that's what Middlegen does. -And that's why it's required on Oracle (and maybe other databases too) when Middlegen is run. The JDBC spec is so fuzzy it doesn't say anything about this.

However, the EJB container calls "regular" JDBC methods, and the schema name is no longer required (because it is implicit as you say) - at least in most cases. -But IIRC, someone requested a while ago that the schema name be present _also_ in the deployment descriptors, and therefore in the @ejb.persistence tags that Middlegen generates.

It all boils down to that we need an option on the cmp20 plugin like useSchemaPrefix="true|false" (with default to false) that decides whether the tags should be generated with or without the schema prefix.

-And that's what Scott has a patch for (I hope).

P.S. could you please turn off HTML email? That makes it easier to inline comments when answering.

Cheers,
Aslak

-----Original Message-----
From: Rod Macpherson [mailto:***@verilet.com]
Sent: 4. desember 2002 01:22
To: Aslak Hellesøy; ***@edge.net; middlegen-***@lists.sourceforge.net
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver


The schema is normally implicit when logging in as an oracle user so it is surprising that a schema name is required in middlegen but it is definitely required. The problem is that when you deploy under JBoss the schema qualifier causes a failure. I solved this by filtering jbosscmp-jdbc.xml to remove the schema prefix on table-name elements and that worked fine. So you need the schema to generate the code but you have to filter it out before you deploy to JBoss. That seems to be the situation with oracle/jboss at least. Sounds like a possible JBoss error?

-----Original Message-----
From: Aslak Hellesøy [mailto:***@netcom.no]
Sent: Tue 12/3/2002 3:32 PM
To: ***@edge.net; middlegen-***@lists.sourceforge.net
Cc:
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
-----Original Message-----
Sent: 3. desember 2002 23:46
Subject: [Middlegen-user] mssql 2000 jdbc driver
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence table-name="contacts",
errors which abort the deployment.
We added the schema name because some ejb container (or was it jdbc driver?)
required the schema name to _be_ present.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I didn't
Currently there is no such option. Your patch to make this optional is most
welcome.
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed, I'll submit
it as a patch.
Thanks,
Scott
Cheers,
Aslak
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
Aslak Hellesøy
2002-12-03 23:06:06 UTC
Permalink
-----Original Message-----
Hellesøy
Sent: 4. desember 2002 01:43
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
I guess that while calling "regular" JDBC methods the schema name
is implicit, but in the various methods in DatabaseMetadata it's
not. -Probably because you might be logged in as one user/schema,
but still might want to look at the structure (=metadata) for
other schemas. So schema name is (and this is a guess) _not_
implicit when dealing with the DatabaseMetadata methods. -And
that's what Middlegen does. -And that's why it's required on
Oracle (and maybe other databases too) when Middlegen is run. The
JDBC spec is so fuzzy it doesn't say anything about this.
However, the EJB container calls "regular" JDBC methods, and the
schema name is no longer required (because it is implicit as you
say) - at least in most cases. -But IIRC, someone requested a
while ago that the schema name be present _also_ in the
tags that Middlegen generates.
It all boils down to that we need an option on the cmp20 plugin
like useSchemaPrefix="true|false" (with default to false) that
Ok, I've implemented it. CVS update fellows.
decides whether the tags should be generated with or without the
schema prefix.
-And that's what Scott has a patch for (I hope).
No need to submit a patch Scott. It's already implemented. Thanks anyway!

Aslak
P.S. could you please turn off HTML email? That makes it easier
to inline comments when answering.
Cheers,
Aslak
-----Original Message-----
Sent: 4. desember 2002 01:22
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
The schema is normally implicit when logging in as an oracle user
so it is surprising that a schema name is required in middlegen
but it is definitely required. The problem is that when you
deploy under JBoss the schema qualifier causes a failure. I
solved this by filtering jbosscmp-jdbc.xml to remove the schema
prefix on table-name elements and that worked fine. So you need
the schema to generate the code but you have to filter it out
before you deploy to JBoss. That seems to be the situation with
oracle/jboss at least. Sounds like a possible JBoss error?
-----Original Message-----
Sent: Tue 12/3/2002 3:32 PM
Subject: RE: [Middlegen-user] mssql 2000 jdbc driver
-----Original Message-----
Sent: 3. desember 2002 23:46
Subject: [Middlegen-user] mssql 2000 jdbc driver
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence
table-name="contacts",
in syntax
errors which abort the deployment.
We added the schema name because some ejb container (or was it
jdbc driver?)
required the schema name to _be_ present.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change.
I didn't
Currently there is no such option. Your patch to make this
optional is most
welcome.
see one but I haven't used middlegen very long so I could have easily
missed something. If it turns out that the change is needed,
I'll submit
it as a patch.
Thanks,
Scott
Cheers,
Aslak
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Kristoffer Moe
2002-12-04 06:04:03 UTC
Permalink
A simple workaround is to make your ejbdoclet task remove the dbo prefix:

<!-- remove .dbo prefix from jbosscmp-jdbc.xml -->
<replace file="${build.ejb-meta.dir}/META-INF/jbosscmp-jdbc.xml"
token="dbo." value=""/>

-in a JBoss 3.0.4 scenario, anyway.

Regards,

Kristoffer
Post by w***@edge.net
Hi,
I have a small problem with middlegen when I use the mssql 2000 jdbc
driver. It puts the schema name in front of the table name in the
@ejb.persistence tag. Instead of @ejb.persistence
table-name="dbo.contacts". This results in syntax errors which abort
the deployment.
I added an option to middlegen to take care of the problem but I was
wondering if there was a way to fix it without a source change. I
didn't see one but I haven't used middlegen very long so I could have
easily missed something. If it turns out that the change is needed,
I'll submit it as a patch.
Thanks,
Scott
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Mhv/regards,


Kristoffer Moe
Senior Consultant
Elan It ReSource

Loading...