Skip to content

Commit

Permalink
发布博客,时间:2024/11/25 15:09:19
Browse files Browse the repository at this point in the history
  • Loading branch information
whp98 committed Nov 25, 2024
1 parent eecfd0f commit df9c5e5
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ https://cn.quarkus.io/guides/hibernate-orm-panache

## 如何简单使用


### 1. 创建实体类

```java
Expand Down Expand Up @@ -40,4 +41,19 @@ return Result.ok(all.firstResult());

```java
PanacheQuery<Book> all = Book.findAll(Sort.by("id", Sort.Direction.Descending)).page(dto.getCurrentPage() - 1, dto.getPageSize());
```
```

### 5.保存数据
```java
Book book = new Book();
book.title = "Java";
book.author = "xxx";
book.persist();
```
### 6.删除数据

```java
Book book = Book.findById(1L);
book.delete();
```

0 comments on commit df9c5e5

Please sign in to comment.