![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
会飞的尼古拉斯
没有个性,但比较尿性
展开
-
搭建 spring boot
1 安装stshttps://spring.io/guides/gs/rest-service/ 这个是如何搭建Spring boot原创 2019-07-23 14:56:20 · 119 阅读 · 0 评论 -
hibernate 设置主键为Guid
我们都知道mybatis支持主键回传(selectkey)设置主键,hibernate也可以设置主键策略 @Id @Column(name = "guid") @GeneratedValue(generator="test") @GenericGenerator(name="test",strategy="uuid.hex") private String guid;...原创 2019-10-19 13:40:32 · 303 阅读 · 0 评论 -
hibernate pagination
OverviewPagination is often helpful when we have a large dataset and we want to present it to the user in smaller chunks.Also, we often need to sort that data by some criteria while paging.In thi...转载 2019-10-18 16:44:11 · 190 阅读 · 0 评论 -
Hibernate One to One Mapping
Various supported techniquesIn hibernate there are 3 ways to create one-to-one relationships between two entities. Either way we have to use @OneToOne annotation.First technique is most widely used ...原创 2019-10-11 15:41:06 · 204 阅读 · 0 评论 -
mybatis连接postgresql
1 driver<?xml version="1.0" encoding="UTF-8"?>2 通过mapper获取值是个listhttps://www.cnblogs.com/fangke/p/9388315.html转载 2019-07-16 14:20:36 · 1756 阅读 · 0 评论 -
eclipse Java运行以及一个Java文件中创建多个类
创建工程后,运行提示 Eclipse Error: Could not find or load main class [duplicate]run Project -> Clean然后再次运行程序即可Java中创建多个类一个java文件里面写多个class的话,这里面最多有一个public的。而且.java的名称和public 类得名称要一致...原创 2019-05-17 11:09:21 · 9599 阅读 · 0 评论 -
hibernate 列数据转换
在需要转换的model字段上添加注释@ColumnTransformer(read="kg*1000",write="?/1000")表结构:model:@Entity@Table(name = "testguid")public class GUID implements Serializable { @Id @Column(name = "guid") @Generat...原创 2019-11-04 08:29:44 · 506 阅读 · 0 评论 -
Hibernate 查询语句映射到类
博主之前用的C#ORM 比较多,就想着Hibernate是否也会支持自定义查询函数并映射到实体类(无法创建视图的时候使用)。解决方案如下:定义类以及sql:@Entity@Immutable@Subselect(value = "select t.id,t.name,m.money from test t left outer join moneys m on t.id=m.id")//...原创 2019-10-20 12:28:03 · 192 阅读 · 0 评论 -
hibernate batch delete
Hibernate 批量删除:Repository 部分 @Modifying @Transactional @Query("delete from GUID where name in :list") void deleteByBatch(@Param("list") List<String> list);Controller 部分 @RequestMapping(p...原创 2019-10-16 12:22:28 · 282 阅读 · 0 评论 -
springboot hibernate@Query 自定义删除、更新
美好的一周要结束了,写一篇博客(上周五就应该写的)我们在运用hibernate的时候,经常会用到更新数据库以及删除数据的功能,hibernate提供了根据主键删除的功能,当然我们也可以自定义这些功能如下:@Repositorypublic interface FavorRegistory extends JpaRepository<FavorTable, Long>{ /*...原创 2019-10-13 12:01:18 · 1082 阅读 · 0 评论 -
Hibernate one to many
Hibernate one to many mapping solutionsThis problem can be solved in two different ways.One is to have a foreign key column in account table i.e. EMPLOYEE_ID. This column will refer to primary key o...转载 2019-10-11 16:42:43 · 222 阅读 · 0 评论 -
springboot hibernate(demo)
技术永不止步Creating the ProjectSpring Boot provides a web tool called Spring Initializer to bootstrap an application quickly. Just go to http://start.spring.io and follow the steps below to generate a ne...原创 2019-10-04 08:36:01 · 418 阅读 · 0 评论