fix: Add GenerationType and Transactional annotations#59
fix: Add GenerationType and Transactional annotations#59Emily-Jiang merged 1 commit intomicroprofile:mainfrom
Conversation
Add missing annotations required for the examples to work properly: - `@GeneratedValue(strategy = GenerationType.IDENTITY)` for auto-incremental id - `@Transactional` for the `DELETE` endpoint to work
In this tutorial, we intentionally use @Id
@GeneratedValue
private Long id;This is equivalent to The provider defaults are as below:
This choice improves the portability of the tutorial because the same examples can run across different databases without forcing an ID strategy that may not exist. |
I would add the above explanation as a note in the README.adoc file via a separate PR so that other developer understand why no explicit strategy was mentioned. |
I would be updating the code via a separate PR at appropriate places. |
The examples have been tested thoroughly and are working properly without these annotations. See my earlier comments for an explanation of why the above annotations was not added in the code examples. |
Add missing annotations required for the examples to work properly:
@GeneratedValue(strategy = GenerationType.IDENTITY)for auto-incremental id@Transactionalfor theDELETEendpoint to work