-->
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.  [ 3 posts ] 
Author Message
 Post subject: getTables() function implementation in hibernate 5
PostPosted: Tue Jul 04, 2017 1:58 am 
Newbie

Joined: Thu May 11, 2017 6:43 am
Posts: 13
I was looking at the implementation of
Code:
public NameSpaceTablesInformation getTables(Identifier catalog, Identifier schema)
and
Code:
public TableInformation getTable(Identifier catalog, Identifier schema, Identifier tableName)


function and found a little bit of discrepancy in the implementation part. On looking at the comments, the way to go is:
// The table did not define an explicit namespace:
1) look in current namespace
2) look in default namespace
3) look in all namespaces - multiple hits is considered an error

I believe the same logic is also applied in getTables(Identifier catalog, Identifier schema) function, except that the schemaFilter has been initialized to "" instead of null.
Please refer to this piece of code https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java#L320

I checked the parameter definition of ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
[url]https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[])[/url]
, which says
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

since the code checks for the condition that database support schemas, i think it should be initialized to null instead of "".

Let me know your thoughts.


Top
 Profile  
 
 Post subject: Re: getTables() function implementation in hibernate 5
PostPosted: Tue Jul 04, 2017 3:38 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You should better ask this question on the Hibernate mailing list.


Top
 Profile  
 
 Post subject: Re: getTables() function implementation in hibernate 5
PostPosted: Tue Jul 04, 2017 4:17 am 
Newbie

Joined: Thu May 11, 2017 6:43 am
Posts: 13
Thanks for the reference, i have dropped a mail on Hibernate Mailing list.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.