Postgresql+Springboot yml基本使用[通俗易懂]

Postgresql+Springboot yml基本使用[通俗易懂]一、Postgresql介绍PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现在商业网站数据库中。PostgreSQL支持大部分的SQL标准并且提供了很多其他现代特性,如复杂查询、外键、触发器、视图、事务完整性、多版本并发控制等。同样,PostgreSQL也可以用许多方法扩展,例如通过增加新的数据类型、函数、操作符、聚集函

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

一、Postgresql介绍

PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现在商业网站数据库中。PostgreSQL支持大部分的SQL标准并且提供了很多其他现代特性,如复杂查询、外键、触发器、视图、事务完整性、多版本并发控制等。同样,PostgreSQL也可以用许多方法扩展,例如通过增加新的数据类型、函数、操作符、聚集函数、索引方法、过程语言等。另外,因为许可证的灵活,任何人都可以以任何目的免费使用、修改和分发PostgreSQL。

1.、 PostgostreSQL 稳定性很强,在崩溃等场景下抗打击能力特别强,对比mysql在电脑崩溃等情景下的丢失数据情况,PG数据库这方面要好一些。

2.、对比Mysql,PostgostreSQL支持的数据类型更多

3.、PostgostreSQL可以使用sql进行编程

4.、PG 的有多种集群架构可以选择,plproxy 可以支持语句级的镜像或分片,slony 可以进行字段级的同步设置,standby 可以构建WAL文件级或流式的读写分离集群,同步频率和集群策略调整方便,操作非常简单。

5.、PostgreSQL的可以使用函数和条件索引

6.、PG 的 TEXT 类型可以直接访问,SQL语法内置正则表达式,能够索引,还可以全文检索。用PG的话,文档数据库都可以省了。

7.、 PostgreSQL的性能很强,在高并发读写的场景下,PostgreSQL的性能指标依旧可以维持顶峰,相对比 MySQL 在同样的场景下会出现一个明显的下滑(mysql5.5之后,在企业级版本中有个插件可以改善很多,不过需要付费)。

二、Postgresql+Springboot yml基本使用

1.导入Maven

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>

Jetbrains全家桶1年46,售后保障稳定

2.编写yml配置文件

spring:
  datasource:

    url: jdbc:postgresql://localhost:5432/postgres # url: jdbc:mysql://localhost:3306/tis?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false
    username: postgres
    password: 123456
    driverClassName: org.postgresql.Driver
  jackson:
    time-zone: GMT+8
  jpa:
    properties:
      open-in-view: true
      hibernate:
        show_sql: false
        format_sql: true
        dialect: org.hibernate.dialect.PostgreSQLDialect
        temp:
          use_jdbc_metadata_defaults: false
        hbm2ddl:
          auto: update
    database: postgresql

  rabbitmq:
    host: 192.168.90.205
    port: 5672
    username: admin
    password: admin
    virtual-host: /

3.编写Entity实体类

package com.supcon.oms.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author: zhaoxu
* @date: 2020/9/8 20:43
*/
@Data
@Entity
@Table(name = "t_tank", schema = "public", catalog = "")
@JsonIgnoreProperties(ignoreUnknown = true)
public class TTankEntity implements Serializable { 

private static final long serialVersionUID = 4718371560086576837L;
@Id
@Column(name="tank_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer tankId;
@Basic
@Column(name = "tank_no", nullable = false, length = 255)
private String tankNo;
@Basic
@Column(name = "equipment_type", nullable = true, length = 255)
private String equipmentType;
@Basic
@Column(name = "tank_name", nullable = true, length = 255)
private String tankName;
@Basic
@Column(name = "tank_description", nullable = true, length = 1000)
private String tankDescription;
@Basic
@Column(name = "equipment_status", nullable = true, length = 255)
private String equipmentStatus;
@Basic
@Column(name = "tank_keepwarm", nullable = true, length = 100)
private String tankKeepwarm;
@Basic
@Column(name = "tank_status", nullable = true, length = 255)
private String tankStatus;
@Basic
@Column(name = "tank_farmid", nullable = true, length = 255)
private String tankFarmid;
@Basic
@Column(name = "tank_type", nullable = true, length = 255)
private String tankType;
@Basic
@Column(name = "tank_diameter", nullable = true, precision = 0)
private Double tankDiameter;
@Basic
@Column(name = "tank_height", nullable = true, precision = 0)
private Double tankHeight;
@Basic
@Column(name = "tank_capacity_standard", nullable = true, precision = 0)
private Double tankCapacityStandard;
@Basic
@Column(name = "liquid_level_temperature", nullable = true, precision = 0)
private Double liquidLevelTemperature;
@Basic
@Column(name = "tank_capacity_safe", nullable = true, precision = 0)
private Double tankCapacitySafe;
@Basic
@Column(name = "calculate_type", nullable = true, length = 255)
private String calculateType;
@Basic
@Column(name = "working_level_min", nullable = true, precision = 0)
private Double workingLevelMin;
@Basic
@Column(name = "working_level_max", nullable = true, precision = 0)
private Double workingLevelMax;    @Basic
@Column(name = "nominal_volume", nullable = true, precision = 0)
private Double nominalVolume;
@Basic
@Column(name = "thermal_expansion_system", nullable = true, length = 255)
private String thermalExpansionSystem;
@Basic
@Column(name = "floating_point_quality", nullable = true, length = 255)
private String floatingPointQuality;
@Basic
@Column(name = "level_change_dead", nullable = true, length = 100)
private String levelChangeDead;
@Basic
@Column(name = "alarm_events", nullable = true, length = 255)
private String alarmEvents;
@Basic
@Column(name = "tank_capacity_now", nullable = true, precision = 0)
private Double tankCapacityNow;
@Basic
@Column(name = "tank_quality", nullable = true, precision = 0)
private Double tankQuality;
@Basic
@Column(name = "tank_temperature", nullable = true, precision = 0)
private Double tankTemperature;
@Basic
@Column(name = "tank_pressure", nullable = true, precision = 0)
private Double tankPressure;
@Basic
@Column(name = "flow_speed", nullable = true, precision = 0)
private Double flowSpeed;
@Basic
@Column(name = "flow_amount", nullable = true, precision = 0)
private Double flowAmount;
@Basic
@Column(name = "remaining_space", nullable = true, precision = 0)
private Double remainingSpace;
@Basic
@Column(name = "vcf", nullable = true, precision = 0)
private Double vcf;
@Basic
@Column(name = "liquid_level_status", nullable = true, length = 255)
private String liquidLevelStatus;
@Basic
@Column(name = "net_standard_volume", nullable = true, precision = 0)
private Double netStandardVolume;
@Basic
@Column(name = "water_bottom_volume", nullable = true, precision = 0)
private Double waterBottomVolume;
@Basic
@Column(name = "tank_flow_inout", nullable = true, precision = 0)
private Double tankFlowInout;
@Basic
@Column(name = "usable_volume", nullable = true, precision = 0)
private Double usableVolume;
@Basic
@Column(name = "standard_quality_sum", nullable = true, precision = 0)
private Double standardQualitySum;
@Basic
@Column(name = "standard_quality_net", nullable = true, precision = 0)
private Double standardQualityNet;
@Basic
@Column(name = "working_volume_max", nullable = true, precision = 0)
private Double workingVolumeMax;
@Basic
@Column(name = "working_volume_min", nullable = true, precision = 0)
private Double workingVolumeMin;
@Basic
@Column(name = "liquid_level", nullable = true, precision = 0)
private Double liquidLevel;
@Basic
@Column(name = "physical_temperature", nullable = true, precision = 0)
private Double physicalTemperature;
@Basic
@Column(name = "ambient_temperature", nullable = true, precision = 0)
private Double ambientTemperature;
@Basic
@Column(name = "density_of_material", nullable = true, precision = 0)
private Double densityOfMaterial;
@Basic
@Column(name = "police_liquid_level", nullable = true, length = 255)
private String policeLiquidLevel;
@Basic
@Column(name = "police_temperature", nullable = true, length = 255)
private String policeTemperature;
@Basic
@Column(name = "police_liquid_switch", nullable = true, length = 255)
private String policeLiquidSwitch;
@Basic
@Column(name = "police_instrument_system", nullable = true, length = 255)
private String policeInstrumentSystem;
@Basic
@Column(name = "police_inout_volume", nullable = true, length = 255)
private String policeInoutVolume;
@Basic
@Column(name = "oms_source_target", nullable = true)
private Integer omsSourceTarget;
@Basic
@Column(name = "oms_share", nullable = true)
private Integer omsShare;
@Basic
@Column(name = "oms_share_depth", nullable = true)
private Integer omsShareDepth;
@Basic
@Column(name = "oms_occupy", nullable = true)
private Integer omsOccupy;
@Basic
@Column(name = "materiel_name", nullable = true, length = 255)
private String materielName;
@Basic
@Column(name = "materiel_type", nullable = true, length = 255)
private String materielType;
@Basic
@Column(name = "materiel_quality_attributes", nullable = true, length = 255)
private String materielQualityAttributes;
@Basic
@Column(name = "materiel_density", nullable = true, precision = 0)
private Double materielDensity;
}

其他的按照正常的框架写就可以了,和mysql的使用方式基本上没有区别

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/215524.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • goland 激活码(注册激活)

    (goland 激活码)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。https://javaforall.cn/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~MLZPB5EL5Q-eyJsaWNlbnNlSWQiOi…

  • android rsa加密工具类,GitHub – Lerist/encrypt: Android 加密解密工具包。「建议收藏」

    android rsa加密工具类,GitHub – Lerist/encrypt: Android 加密解密工具包。「建议收藏」Encrypt(加密工具)字符串,byte[],文件等对象的加密和解密工具集合,包含了多种加密方案。加密类型摘要相关方法简单加密换一种编码格式Base64Util单向加密只能加密,不能解密MD5Util、SHAUtil对称加密使用相同的秘钥加密和解密AESUtil、DESUtil非对称加密分公钥和私钥,一个加密,另一个解密RSAUtil使用方法Base64util方法摘要Stringbase6…

  • 苹果电脑navicat premium激活码-激活码分享[通俗易懂]

    (苹果电脑navicat premium激活码)JetBrains旗下有多款编译器工具(如:IntelliJ、WebStorm、PyCharm等)在各编程领域几乎都占据了垄断地位。建立在开源IntelliJ平台之上,过去15年以来,JetBrains一直在不断发展和完善这个平台。这个平台可以针对您的开发工作流进行微调并且能够提供…

  • vue项目中使用ueditor

    vue项目中使用ueditor

    2021年10月11日
  • Java商城源码最好用的java商城电商系统之一

    Java商城源码最好用的java商城电商系统之一为符合新互联网+时代产品线即时起更新演示网址:2021单店版:http://mall.javaemall.com/index.htm2021多店版:http://www.javaemall.com/index.htm源码包含:PC版网站+手机触屏站+APP客户端(安卓+苹果)+微信版(小程序+公众号)几套区别:2021版升级了移动端新功能和UI页面,更符合扁平简约化潮流,新增微信小程序,底层技术框架升级。多店版就是多店铺多商户,多用户B2B2C功能,能入驻开店。单店版是自营B…

  • icem划分网格步骤_ICEM CFD教程-icem网格划分教程

    icem划分网格步骤_ICEM CFD教程-icem网格划分教程ICEMCFD教程四面体网格对于复杂外形,ICEMCFDTetra具有如下优点:根据用户事先规定一些关键的点和曲线基于8叉树算法的网格生成,生成速度快,大约为1500cells/second无需表面的三角形划分,直接生成体网格四面体网格能够合并到混合网格中,并实施平滑操作单独区域的粗化和细化ICEMCFD的CAD(CATIAV4,UG,ProE,IGES,andP…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号