11///////////////////////////////////////////////////////////////////////////////
22
3- Copyright (c) 2019, 2021 Oracle and/or its affiliates.
3+ Copyright (c) 2019, 2022 Oracle and/or its affiliates.
44
55 Licensed under the Apache License, Version 2.0 (the "License");
66 you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ https://jakarta.ee/specifications/persistence/2.2/[Java Persistence
2727API (JPA)] from within a Helidon MP application.
2828
2929== What You Need
30- For this 30 minute tutrial , you'll need the following:
30+ For this 30 minute tutorial , you'll need the following:
3131
3232include::{common-page-prefix-inc}[tag=common-prereqs-curl]
3333
@@ -146,15 +146,19 @@ Add the following dependencies in your `pom.xml`:
146146[source,xml]
147147.`pom.xml`
148148----
149+ <dependency>
150+ <artifactId>jakarta.ws.rs-api</artifactId>
151+ <scope>compile</scope>
152+ </dependency>
149153<dependency>
150154 <groupId>jakarta.persistence</groupId>
151155 <artifactId>jakarta.persistence-api</artifactId>
152- <scope>provided </scope>
156+ <scope>compile </scope>
153157</dependency>
154158<dependency>
155159 <groupId>jakarta.transaction</groupId>
156160 <artifactId>jakarta.transaction-api</artifactId>
157- <scope>provided </scope>
161+ <scope>compile </scope>
158162</dependency>
159163----
160164
@@ -275,47 +279,47 @@ public class Greeting implements Serializable { <4>
275279}
276280----
277281
278- <1> (Some of the annotations in this example, like this one, have
282+ <1> (Some annotations in this example, like this one, have
279283sensible defaults, but the example specifies them explicitly for
280284clarity.) This
281- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/access[`Access`
285+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/access[`Access`
282286annotation] says that JPA will access this class' fields directly,
283287rather than via getter and setter methods.
284288
285289<2> The
286- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/entity[`Entity`
290+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/entity[`Entity`
287291annotation] identifies this class as a JPA entity. The
288- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/entity#name()[`name`
292+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/entity#name()[`name`
289293element] value can be used in JPQL queries.
290294
291295<3> The
292- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/table[`Table`
296+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/table[`Table`
293297annotation] identifies the database table to which this class will be
294298mapped.
295299
296300<4> JPA entities should be
297- https://docs.oracle.com/en/java/javase/11 /docs/api/java.base/java/io/Serializable.html[`Serializable`].
301+ https://docs.oracle.com/en/java/javase/17 /docs/api/java.base/java/io/Serializable.html[`Serializable`].
298302
299303<5> The
300- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/column[`Column`
304+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/column[`Column`
301305annotation] specifies what column in the database the annotated field
302306maps to. The elements of the `Column` annotation further describe the
303307column.
304308
305309<6> The
306- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/id[`Id`
310+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/id[`Id`
307311annotation] indicates this field will be mapped to the primary key of
308312the database table.
309313
310314<7> The
311- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/basic[`Basic`
315+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/basic[`Basic`
312316annotation] indicates this field will be mapped to an ordinary
313317("basic") column.
314318
315319<8> All JPA entities need a zero-argument constructor, but it doesn't
316320have to be `public`. This constructor satisfies this requirement. It
317321is marked
318- https://docs.oracle.com/en/java/javase/11 /docs/api/java.base/java/lang/Deprecated.html[`Deprecated`]
322+ https://docs.oracle.com/en/java/javase/17 /docs/api/java.base/java/lang/Deprecated.html[`Deprecated`]
319323and is non-`public` so that normal users have to supply data for the
320324`salutation` and `response` fields via the other constructor.
321325
@@ -329,11 +333,11 @@ Add the following file under `src/main/resources/META-INF`:
329333.`src/main/resources/META-INF/persistence.xml`
330334----
331335<?xml version="1.0" encoding="UTF-8"?>
332- <persistence version="2.2 " <1>
333- xmlns="http ://xmlns.jcp.org /xml/ns/persistence"
336+ <persistence version="3.0 " <1>
337+ xmlns="https ://jakarta.ee /xml/ns/persistence"
334338 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
335- xsi:schemaLocation="http ://xmlns.jcp.org /xml/ns/persistence
336- http ://xmlns.jcp.org /xml/ns/persistence/persistence_2_2 .xsd">
339+ xsi:schemaLocation="https ://jakarta.ee/xml /xml/ns/persistence
340+ https ://jakarta.ee /xml/xml/ ns/persistence/persistence_3_0 .xsd">
337341 <persistence-unit name="greeting" transaction-type="JTA"> <2>
338342 <description>A persistence unit for the greeting example.</description>
339343 <jta-data-source>greetingDataSource</jta-data-source> <3>
@@ -351,7 +355,7 @@ Add the following file under `src/main/resources/META-INF`:
351355</persistence>
352356----
353357
354- <1> Helidon MP's JPA extension supports JPA 2.2 .
358+ <1> Helidon MP's JPA extension supports JPA 3.0 .
355359
356360<2> Note that `JTA` is the transaction type. JTA transactions are
357361fully supported.
@@ -362,20 +366,20 @@ fully supported.
362366<4> The `Greeting` class you created is listed here.
363367
364368<5> The properties listed here are in general
365- https://www.eclipse.org/eclipselink/documentation/2.7 /jpa/extensions/persistenceproperties_ref.htm[EclipseLink
369+ https://www.eclipse.org/eclipselink/documentation/3.0 /jpa/extensions/persistenceproperties_ref.htm[EclipseLink
366370properties]. Many are optional, but a few (detailed below) are required.
367371
368- <6> https://www.eclipse.org/eclipselink/documentation/2.7 /jpa/extensions/persistenceproperties_ref.htm#target-database[This
372+ <6> https://www.eclipse.org/eclipselink/documentation/3.0 /jpa/extensions/persistenceproperties_ref.htm#target-database[This
369373property] is required when EclipseLink is the JPA provider. It is set
370374to `org.eclipse.persistence.platform.database.H2Platform` because this
371375example uses the H2 database.
372376
373- <7> https://www.eclipse.org/eclipselink/documentation/2.7 /jpa/extensions/persistenceproperties_ref.htm#target-server[This
377+ <7> https://www.eclipse.org/eclipselink/documentation/3.0 /jpa/extensions/persistenceproperties_ref.htm#target-server[This
374378property] is required, and when EclipseLink is the JPA provider must
375379have the value
376380`io.helidon.integrations.cdi.eclipselink.CDISEPlatform`.
377381
378- <8> https://www.eclipse.org/eclipselink/documentation/2.7 /jpa/extensions/persistenceproperties_ref.htm#weaving[This
382+ <8> https://www.eclipse.org/eclipselink/documentation/3.0 /jpa/extensions/persistenceproperties_ref.htm#weaving[This
379383property] is required when EclipseLink is the JPA provider and must be
380384set to `false`.
381385
@@ -457,9 +461,9 @@ private EntityManager em;
457461----
458462
459463<1> The
460- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/persistencecontext[`@PersistenceContext`
464+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/persistencecontext[`@PersistenceContext`
461465annotation] indicates that you want an
462- https://jakarta.ee/specifications/persistence/2.2 /apidocs/javax/persistence/entitymanager[`EntityManager`]
466+ https://jakarta.ee/specifications/persistence/3.0 /apidocs/javax/persistence/entitymanager[`EntityManager`]
463467injected here.
464468
465469== Use the Injected `EntityManager`
0 commit comments