You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/15 01:30:05 UTC

[GitHub] [shardingsphere] dandanwendy opened a new issue, #22876: JPA auto create table throws an exception

dandanwendy opened a new issue, #22876:
URL: https://github.com/apache/shardingsphere/issues/22876

   ## Question
   
   when I use sharding-jdbc in  project and datasource has table T_MSSI_KMS_SECRET_KEY, JPA auto create table throws an exception as belows, have you seen this problem?
   
   Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate Session#******#ption is org.apache.shardingsphere.sharding.route.engine.exception.TableExistsException: Table 'T_MSSI_KMS_SECRET_KEY' already exists.
   
   here is my JPA setting:
     jpa:
       hibernate:
         ddl-auto: update
         naming:
           physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
   
   here is my shardingsphere setting by javaBean
       private static ShardingTableRuleConfiguration getTMssiKmsSecretKeyTableRuleConfiguration() {
           ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(
                   "T_MSSI_KMS_SECRET_KEY", "db1.T_MSSI_KMS_SECRET_KEY");
           return result;
       }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] JPA auto create table throws an exception [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-2026017880

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] azexcy commented on issue #22876: JPA auto create table throws an exception

Posted by GitBox <gi...@apache.org>.
azexcy commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-1352451974

   > > Hi @dandanwendy it is impossible to know exactly why the problem occurred from the description. What database are you using?
   > 
   > when I set ddl-auto none rather than update, there is no exception. jpa: hibernate: ddl-auto: update
   
   Ok, I guess maybe this table really exists already, you could add log `org.apache.shardingsphere.infra.executor.sql.log.SQLLogger` which will output Actual SQL, then we know exactly which statements were executed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] JPA auto create table throws an exception [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-2241759549

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] JPA auto create table throws an exception [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-2212389410

   The issue involves many thrid-party dependencies, but we are focusing only on ShardingSphere itself. Since ShardingSphere implements the JDBC interface, could you please debug the program to show the specific issue with the JDBC calls, or provide a demo on GitHub for easy reproduction of the problem?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dandanwendy commented on issue #22876: JPA auto create table throws an exception

Posted by GitBox <gi...@apache.org>.
dandanwendy commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-1352448792

   > Hi @dandanwendy it is impossible to know exactly why the problem occurred from the description. What database are you using?
   
   when I set ddl-auto none rather than update, there is no exception.
     jpa:
       hibernate:
         ddl-auto: update


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dandanwendy commented on issue #22876: JPA auto create table throws an exception

Posted by GitBox <gi...@apache.org>.
dandanwendy commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-1352447500

   > Hi @dandanwendy it is impossible to know exactly why the problem occurred from the description. What database are you using?
   
   mysql 8.0, and driver is driver-class-name: org.mariadb.jdbc.Driver. I can't show more infomation cause company's infomation security.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] azexcy commented on issue #22876: JPA auto create table throws an exception

Posted by GitBox <gi...@apache.org>.
azexcy commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-1352445182

   Hi @dandanwendy it is impossible to know exactly why the problem occurred from the description.
   What database are you using? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] JPA auto create table throws an exception [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #22876:  JPA auto create table throws an exception
URL: https://github.com/apache/shardingsphere/issues/22876


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] JPA auto create table throws an exception [shardingsphere]

Posted by "wanghongzhou (via GitHub)" <gi...@apache.org>.
wanghongzhou commented on issue #22876:
URL: https://github.com/apache/shardingsphere/issues/22876#issuecomment-1769862534

   I also encountered the same issue, so I debugged the code. I found that in the `performTablesMigration` method of the `GroupedSchemaMigratorImpl` class, when calling `final NameSpaceTablesInformation tables = existingDatabase.getTablesInformation(namespace);` it failed to retrieve the tables. so resulted in the creation of new tables.
   
   Upon further investigation, I noticed that the `currentCatalog` field in the `JdbcEnvironmentImpl` was empty. This caused the `AbstractInformationExtractorImpl` to be unable to retrieve table information when calling `getTable`. The root cause of the issue appears to be that the `ShardingSphereConnection` class's `getCatalog` method is returning null. 
   
   I'm using Hibernate version 6.2.5 and ShardingSphere version 5.3.2.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org