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 2020/09/23 11:39:09 UTC

[GitHub] [shardingsphere] leexiaominghub opened a new issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

leexiaominghub opened a new issue #7578:
URL: https://github.com/apache/shardingsphere/issues/7578


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.1.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   JDBC
   
   ### Expected behavior
   no error report
   
   ### Actual behavior
   org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table test_sharding_1 (account_no bigint not null, primary key (account_no)) engine=InnoDB" via JDBC Statement
   Caused by: java.sql.SQLSyntaxErrorException: Table 'account_infor2' already exists
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   this is appliciton.yaml:
   ```yaml
   spring:
     shardingsphere:
       datasource:
         names: ds0, ds1
         ds0:
           type: com.zaxxer.hikari.HikariDataSource
           driver: com.p6spy.engine.spy.P6SpyDriver
           jdbc-url: jdbc:p6spy:mysql://10.64.136.133:3306/lxm
           username: root
           password: 
         ds1:
           type: com.zaxxer.hikari.HikariDataSource
           driver: com.p6spy.engine.spy.P6SpyDriver
           jdbc-url: jdbc:p6spy:mysql://10.62.13.33:3306/lxm1
           username: root
           password: 
       sharding:
         defaultDataSourceName: ds0
         tables:
           test_sharding_0:
             actualDataNodes: ds0.account_infor2
           test_sharding_1:
             actualDataNodes: ds1.account_infor2
     jpa:
       show-sql: true
       generate-ddl: true
   ```
   And here are beans:
   ```java
   @Entity
   @Table(name = "test_sharding_1")
   @Data
   public class Account3 {
   
       @Id
       private Long accountNo;
   }
   
   @Entity
   @Table(name = "test_sharding_0")
   @Data
   public class Account2 {
   
       @Id
       private Long accountNo;
   
   }
   ```
   
   


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] kimmking commented on issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

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


   https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/sharding-example/sharding-spring-boot-jpa-example/src/main/resources/application.properties


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] kimmking closed issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #7578:
URL: https://github.com/apache/shardingsphere/issues/7578


   


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] kimmking commented on issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

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


   https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/sharding-example/sharding-spring-boot-jpa-example/src/main/resources/application.properties


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] leexiaominghub commented on issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

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






----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] yu199195 commented on issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

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


   1.can you config this : `spring.shardingsphere.props.sql.show=true`   
   2 after(1) you  can observe the log ,What kind of SQL is output。


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] kimmking closed issue #7578: when spring.jpa.generate-ddl: true ,jpa sometims report exception of table alread exitsts

Posted by GitBox <gi...@apache.org>.
kimmking closed issue #7578:
URL: https://github.com/apache/shardingsphere/issues/7578


   


----------------------------------------------------------------
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.

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