zoukankan      html  css  js  c++  java
  • Spring Boot JPA 使用 Sql Service 与 不使用默认驼峰策略

    引入 数据源

      

        <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>sqljdbc4</artifactId>
                <version>4.0</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>

    配置链接

     

    spring:
      application:
        name: edi_jmyp
      datasource:
        url: jdbc:sqlserver://10.10.6.19:1533;DatabaseName=IMS
        username: table
        password: QpdvP0
        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

    用那个数据源 就指定那个数据源  driver-class-name 这个字段

    注意!

      链接URL  mysql 与Sql Sservice 区别   一个是  ,  一个 : 

    关于实体类 映射数据库 名称 与 字段 不生效的问题


    比较蛋疼的是 明明有 命名策略可以设置,然而全都是设置的带下划线的!
      
    jpa:
        hibernate:
          naming:
            strategy:  org.hibernate.cfg.DefaultComponentSafeNamingStrategy  /# 这里有 5种策略  就没一个是不带下划线的!

     使用  

      physical-strategy
      jpa:
        show-sql: true
        hibernate:
          naming:
            physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

    直接就是 类/字段 名称是什么  映射的 表名称/列名称  就是什么

    这个问题在早期 版本是没有的!



  • 相关阅读:
    topcoder srm 681 div1
    topcoder srm 683 div1
    topcoder srm 684 div1
    topcoder srm 715 div1
    topcoder srm 685 div1
    topcoder srm 687 div1
    topcoder srm 688 div1
    topcoder srm 689 div1
    topcoder srm 686 div1
    topcoder srm 690 div1 -3
  • 原文地址:https://www.cnblogs.com/atliwen/p/6992843.html
Copyright © 2011-2022 走看看