Skip to content

Commit

Permalink
Merge pull request #16 from OpenLiberty/readme
Browse files Browse the repository at this point in the history
README fixes
  • Loading branch information
mswatosh authored Nov 18, 2023
2 parents 73a149d + 3e84c2e commit f26de28
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ From inside the `sample-jakarta-data` directory, build and start the application
Once the server has started, the application is availible at http://localhost:9080

### Try it out
Give the sample a try by registering a crew member. Enter a name (a String), an ID Number (an **Integer**), and select a Rank from the menu, then click 'Register Crew Member'.
Give the sample a try by registering a crew member. Enter a name (a **String**), an ID Number (an **Integer**), and select a Rank from the menu, then click 'Register Crew Member'.

Two more boxes will appear, one with all of your crew members (which you can click to remove) and one showing your crew members sorted by rank.

Expand All @@ -43,7 +43,7 @@ public class CrewService {
CrewMembers crewMembers;
```

The first endpoint persists a **crewMember** in the database by calling `crewMembers.save()`
The first endpoint persists a **CrewMember** in the database by calling `crewMembers.save()`

```java
public String add(CrewMember crewMember) {
Expand All @@ -55,13 +55,13 @@ public String add(CrewMember crewMember) {
crewMembers.save(crewMember);
```

To remove an individual **crewMember** from the database based on the ID, you can use `crewMembers.deleteByCrewID`
To remove an individual **CrewMember** from the database based on the ID, you can use `crewMembers.deleteByCrewID`
```java
public String remove(@PathParam("id") String id) {
crewMembers.deleteByCrewID(id);
```

In order to display all of our **crewMembers**, you can get all of them easily by calling `crewMembers.findAll()`
In order to display all of our **CrewMember**s, you can get all of them easily by calling `crewMembers.findAll()`
```java
public String retrieve() {
JsonArrayBuilder jab = Json.createArrayBuilder();
Expand All @@ -75,15 +75,15 @@ public interface CrewMembers {
List<CrewMember> findAll();
```

Finally, for a slightly more complex operation, we can ask for a subset of the **crewMembers** with a given **Rank**, using `crewMembers.findByRank()`
Finally, for a slightly more complex operation, we can ask for a subset of the **CrewMember**s with a given **Rank**, using `crewMembers.findByRank()`
```java
public String retrieveByRank(@PathParam("rank") String rank) {
JsonArrayBuilder jab = Json.createArrayBuilder();
for (CrewMember c : crewMembers.findByRank(rank)) {
```

### How it works: Database tier
The application entirely relies on Jakarta Persistence. In Jakarta Persistence, the connection to the database is defined as a **dataSource**. In the Liberty implementation of Jakarta EE, the **dataSource** is configured in the [server.xml](src/main/liberty/config/server.xml).
The application entirely relies on Jakarta Persistence. In Jakarta Persistence, the connection to the database is defined as a **DataSource**. In the Liberty implementation of Jakarta EE, the **DataSource** is configured in the [server.xml](src/main/liberty/config/server.xml).

## Stop Postgres
When you are done trying out the sample application, you can stop the Postgres container with:
Expand Down

0 comments on commit f26de28

Please sign in to comment.