KomachiSion commented on issue #2393: Error when use 
"spring.jpa.hibernate.naming.physical-strategy"
URL: 
https://github.com/apache/incubator-shardingsphere/issues/2393#issuecomment-493812250
 
 
   @softwbc, I can't reproduce your problem, can you provide a example code and 
reproduce steps?
   My example code is 
   
   Entity:
   ```
   @Setter
   @Getter
   @ToString
   @Entity
   @Table(name = "my_friend")
   public class MyFriendEntity {
       
       @Id
       @Column
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       private long id;
       
       @Column
       private String status;
       
       @Column
       private int user_id;
   }
   ```
   
   Repo:
   ```
   public interface MyFriendRepo extends JpaRepository<MyFriendEntity, Long> {
   }
   ```
   
   process:
   ```
           MyFriendRepo repo = applicationContext.getBean(MyFriendRepo.class);
           List<MyFriendEntity> list = new ArrayList<>();
           for (int i = 0; i < 10; i++) {
               MyFriendEntity myFriendEntity = new MyFriendEntity();
               myFriendEntity.setStatus("test");
               myFriendEntity.setUser_id((i % 5) + 100000);
               list.add(myFriendEntity);
           }
           repo.save(list);
   ```
   
   configuration:
   ```
   spring.jpa.show-sql=true
   spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop
   spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
   ##hibernate 5.2.17.Final
   ##Java Model: private String cbOperationId; ==>Table field definition: 
cbOperationId
   ##for field mapping
   ##MySQLSyntaxErrorException: Unknown column 'cb_operation_id' in 'field list'
   
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
   
   sharding.jdbc.datasource.names=test
   sharding.jdbc.datasource.test.type=com.alibaba.druid.pool.DruidDataSource
   sharding.jdbc.datasource.test.driver-class-name=com.mysql.jdbc.Driver
   
sharding.jdbc.datasource.test.url=jdbc:mysql://localhost/demo_ds?characterEncoding=utf8&useSSL=false
   sharding.jdbc.datasource.test.username=root
   sharding.jdbc.datasource.test.password=
   
   
#sharding.jdbc.config.sharding.tables.t_doc_process.actual-data-nodes=test.t_doc_process_$->{0..9}
   
#sharding.jdbc.config.sharding.tables.t_doc_process.table-strategy.inline.sharding-column=docId
   
#sharding.jdbc.config.sharding.tables.t_doc_process.table-strategy.inline.algorithm-expression=test.t_doc_process_$->{docId
 % 10}
   
   #others
   
sharding.jdbc.config.sharding.tables.my_friend.actual-data-nodes=test.my_friend_$->{0..9}
   sharding.jdbc.config.sharding.tables.my_friend.key-generator-column-name=id
   
sharding.jdbc.config.sharding.tables.my_friend.table-strategy.inline.sharding-column=user_id
   
sharding.jdbc.config.sharding.tables.my_friend.table-strategy.inline.algorithm-expression=my_friend_$->{user_id
 % 10}
   
   sharding.jdbc.config.props.sql.show=true
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to