Skip to content

Commit d16d4ec

Browse files
committed
Updated JPA example dependencies
1 parent dceccba commit d16d4ec

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

jpa-hibernate/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ the latest version), JPA, and Hibernate ([check](https://hibernate.org/orm/relea
2020
<dependency>
2121
<groupId>jakarta.persistence</groupId>
2222
<artifactId>jakarta.persistence-api</artifactId>
23-
<version>3.0.0</version>
23+
<version>LATEST</version>
2424
</dependency>
2525
<dependency>
2626
<groupId>org.hibernate</groupId>
@@ -30,7 +30,7 @@ the latest version), JPA, and Hibernate ([check](https://hibernate.org/orm/relea
3030
<dependency>
3131
<groupId>org.glassfish.jaxb</groupId>
3232
<artifactId>jaxb-runtime</artifactId>
33-
<version>3.0.0</version>
33+
<version>LATEST</version>
3434
</dependency>
3535
```
3636

@@ -100,10 +100,17 @@ Apache Maven.
100100
Prepare the database:
101101

102102
```sql
103-
CREATE DATABASE jpa_demo;
104-
CREATE USER 'user'@'%';
105-
GRANT ALL ON jpa_demo.* TO 'user'@'%' IDENTIFIED BY 'password';
106-
103+
CREATE DATABASE demo;
104+
CREATE USER 'user'@'%' IDENTIFIED BY 'Password123!';
105+
GRANT SELECT, INSERT, UPDATE, DELETE ON demo.* TO 'user'@'%';
106+
GRANT DROP, CREATE on demo.* TO 'user'@'%';
107+
108+
USE demo;
109+
CREATE TABLE programming_language(
110+
pl_id INT PRIMARY KEY AUTO_INCREMENT,
111+
pl_name VARCHAR(50) NOT NULL UNIQUE,
112+
pl_rating INT
113+
);
107114
```
108115

109116
Run the following in the command line:

jpa-hibernate/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
<dependency>
1616
<groupId>jakarta.persistence</groupId>
1717
<artifactId>jakarta.persistence-api</artifactId>
18-
<version>3.0.0</version>
18+
<version>3.1.0</version>
1919
</dependency>
2020
<dependency>
2121
<groupId>org.hibernate</groupId>
2222
<artifactId>hibernate-core-jakarta</artifactId>
23-
<version>5.6.4.Final</version>
23+
<version>5.6.15.Final</version>
2424
</dependency>
2525
<dependency>
2626
<groupId>org.glassfish.jaxb</groupId>
2727
<artifactId>jaxb-runtime</artifactId>
28-
<version>3.0.0</version>
28+
<version>4.0.3</version>
2929
</dependency>
3030
<dependency>
3131
<groupId>org.mariadb.jdbc</groupId>
3232
<artifactId>mariadb-java-client</artifactId>
33-
<version>3.0.3</version>
33+
<version>3.2.0</version>
3434
</dependency>
3535
</dependencies>
3636

jpa-hibernate/src/main/resources/META-INF/persistence.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
22
<persistence-unit name="jpa-demo-local" transaction-type="RESOURCE_LOCAL">
33
<properties>
4-
<property name="jakarta.persistence.jdbc.url" value="jdbc:mariadb://localhost:3306/jpa_demo" />
4+
<property name="jakarta.persistence.jdbc.url" value="jdbc:mariadb://localhost:3306/demo" />
55
<property name="jakarta.persistence.jdbc.user" value="user" />
66
<property name="jakarta.persistence.jdbc.password" value="Password123!" />
77
<property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create" />

microprofile/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Add the MicroProfile and Jakarta EE web profile features in the **server.xml** f
8585
</featureManager>
8686
```
8787

88-
Configure the database connection in the **server.xml** file:
88+
Configure the database connection in the **src/main/liberty/config/server.xml** file:
8989

9090
```xml
9191
<library id="jdbcLib">

microprofile/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
<packaging>war</packaging>
88

99
<properties>
10-
<maven.compiler.target>11</maven.compiler.target>
11-
<maven.compiler.source>11</maven.compiler.source>
10+
<maven.compiler.target>21</maven.compiler.target>
11+
<maven.compiler.source>21</maven.compiler.source>
1212
</properties>
1313

1414
<dependencies>
1515
<dependency>
1616
<groupId>org.eclipse.microprofile</groupId>
1717
<artifactId>microprofile</artifactId>
18-
<version>5.0</version>
18+
<version>6.1</version>
1919
<type>pom</type>
2020
<scope>provided</scope>
2121
</dependency>
2222
<dependency>
2323
<groupId>jakarta.platform</groupId>
2424
<artifactId>jakarta.jakartaee-web-api</artifactId>
25-
<version>9.1.0</version>
25+
<version>10.0.0</version>
2626
<scope>provided</scope>
2727
</dependency>
2828
</dependencies>
@@ -63,7 +63,7 @@
6363
<dependency>
6464
<groupId>org.mariadb.jdbc</groupId>
6565
<artifactId>mariadb-java-client</artifactId>
66-
<version>3.0.4</version>
66+
<version>3.2.0</version>
6767
</dependency>
6868
</dependencyGroup>
6969
</copyDependencies>

microprofile/src/main/resources/META-INF/persistence.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
<persistence-unit name="microprofile-demo" transaction-type="JTA">
33
<jta-data-source>jdbc/mariadb-database</jta-data-source> <!-- Use the same name in the application server -->
44
<exclude-unlisted-classes>false</exclude-unlisted-classes>
5-
<properties>
6-
<property name="eclipselink.target-database" value="MySQL" /> <!-- EclipseLink JPA (default JPA implementation in Open Liberty) requires this -->
7-
</properties>
85
</persistence-unit>
96
</persistence>

0 commit comments

Comments
 (0)