-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Thu May 27, 2010 4:09 pm 
Beginner
Beginner

Joined: Fri Mar 26, 2010 11:55 am
Posts: 20
Ah, it looks like the problem is occurring in DefaultDatabaseCollection and in StringHelper, and it's ultimately caused by the fact that MetaMatrix allows table names to contain "." in the names.

DefaultDatabaseCollection creates a qualified list of tables by splitting the fully-qualified name on the last occurrence of ".". It considers everything before the last dot to be the "qualifier", which is used uniquely identify each schema and its set of tables in a Map.

Since MetaMatrix has a NULL catalog name, but also has table names that include dots, the end result is that DefaultDatabaseCollection builds a fully-qualified name that is misinterpreted as if it had a catalog name.

For example:
Catalog: null
Schema: POC
Table: CDB_CIM.GLOBAL_SIZE

Fully-qualified name created by Table.qualify: POC.CDB_CIM.GLOBAL_SIZE
Qualifier, as determined by StringHelper.qualifier(key): POC.CDB_CIM <-- this is "incorrect", should be POC, as CDB_CIM is part of the table name

Later, TableFilterView code gets a TableContainer that appears to have the name of CATALOG.SCHEMA. It splits this string on ".", which results in a catalog=POC and schema=CDB_CIM. Using those values, it produces the incorrect filter string, shown earlier in this thread.

So, the first question is whether table names with dots are legal according to SQL92 and JDBC specifications.

If it is legal, then perhaps DefaultDatabaseCollection's logic could be changed, such that it constructs the qualifier by concatenating the catalog + "." + schema name, rather than by using the StringHelper.qualifier() trick.


Top
 Profile  
 
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Thu May 27, 2010 6:32 pm 
Beginner
Beginner

Joined: Fri Mar 26, 2010 11:55 am
Posts: 20
mwalker wrote:
If it is legal, then perhaps DefaultDatabaseCollection's logic could be changed, such that it constructs the qualifier by concatenating the catalog + "." + schema name, rather than by using the StringHelper.qualifier() trick.


In fact, I made this code change, and it does now work as expected. I'd be happy to share it if you guys think it's worth fixing.

Also took a quick look through the SQL92 specification, along with a trip to Mimer SQL validator, and it appears that dots in table names are technically legal.


Top
 Profile  
 
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Fri May 28, 2010 6:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
mwalker wrote:
mwalker wrote:
If it is legal, then perhaps DefaultDatabaseCollection's logic could be changed, such that it constructs the qualifier by concatenating the catalog + "." + schema name, rather than by using the StringHelper.qualifier() trick.


In fact, I made this code change, and it does now work as expected. I'd be happy to share it if you guys think it's worth fixing.


create a jira with a patch (not the whole file please ;) so we can see.

Quote:
Also took a quick look through the SQL92 specification, along with a trip to Mimer SQL validator, and it appears that dots in table names are technically legal.


it all depends on quoting I believe.

If your table got "." in them how do you distinguish SCH1.TAB1 from SCH1.TAB1 without quoting ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Fri May 28, 2010 5:22 pm 
Beginner
Beginner

Joined: Fri Mar 26, 2010 11:55 am
Posts: 20
I'd be happy to build a patch, but the process is not working for me, at least not using a freshly checked out copy of HibernateExt from SVN.

I notice there is an ant task for creating a patch in common-build.xml, but it references CVS. I originally checked out this code using SVN, per vyemialyanchyk's instructions, so it's a bit odd to see CVS being used here.

When I try to run the ant "patch" task, it complains that CVS is not setup properly. I can modify the task to add the proper CVSROOT in SourceForge, but still get the complaint that I need to checkout the entire project using 'cvs checkout' first. And when I try to checkout the entire project using CVS, I receive a CVS server bug: "cvs checkout: dying gasps from hibernate.cvs.sourceforge.net unexpected".

Am I missing something obvious here? Have you modified your build script in order to build a patch successfully?


Top
 Profile  
 
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Sun May 30, 2010 9:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
mwalker wrote:
I'd be happy to build a patch, but the process is not working for me, at least not using a freshly checked out copy of HibernateExt from SVN.

I notice there is an ant task for creating a patch in common-build.xml, but it references CVS. I originally checked out this code using SVN, per vyemialyanchyk's instructions, so it's a bit odd to see CVS being used here.

When I try to run the ant "patch" task, it complains that CVS is not setup properly. I can modify the task to add the proper CVSROOT in SourceForge, but still get the complaint that I need to checkout the entire project using 'cvs checkout' first. And when I try to checkout the entire project using CVS, I receive a CVS server bug: "cvs checkout: dying gasps from hibernate.cvs.sourceforge.net unexpected".

Am I missing something obvious here? Have you modified your build script in order to build a patch successfully?


if you use eclipse there is a simple Team > Create Patch in the context sensitive menu.

otherwise just use svn diff <directory> to get a patch

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Console configuration does not display database metadata
PostPosted: Tue Jun 01, 2010 2:46 pm 
Beginner
Beginner

Joined: Fri Mar 26, 2010 11:55 am
Posts: 20
Thanks Max.

I created a new JIRA for the table filter wizard issue, and attached my patch file. You can find the JIRA here:
https://jira.jboss.org/browse/JBIDE-6396

I've also attached a patch file to the previous JIRA, dealing with mixed-case table types.

Thanks for all your help and I hope these changes become useful to others.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.