generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from mgueury/main
NoSQL - Helidon 4 - First version / Java QueryIterable
- Loading branch information
Showing
8 changed files
with
102 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
option/src/app/java_helidon/src/main/java/me/opc/mp/database/Message.java.old
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
option/src/app/java_helidon4_nosql/src/main/java/me/opc/mp/database/Dept.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package me.opc.mp.database; | ||
|
||
import jakarta.json.bind.annotation.JsonbVisibility; | ||
import jakarta.nosql.*; | ||
|
||
@Entity | ||
@JsonbVisibility(FieldAccessStrategy.class) | ||
public class Dept { | ||
@Id | ||
private int deptno; | ||
@Column | ||
private String dname; | ||
@Column | ||
private String loc; | ||
} |
9 changes: 9 additions & 0 deletions
9
option/src/app/java_helidon4_nosql/src/main/java/me/opc/mp/database/DeptRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package me.opc.mp.database; | ||
|
||
import jakarta.data.repository.Query; | ||
import jakarta.data.repository.Repository; | ||
import org.eclipse.jnosql.databases.oracle.mapping.OracleNoSQLRepository; | ||
|
||
@Repository | ||
public interface DeptRepository extends OracleNoSQLRepository<Dept, Integer> { | ||
} |
31 changes: 31 additions & 0 deletions
31
option/src/app/java_helidon4_nosql/src/main/java/me/opc/mp/database/DeptResource.j2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{% import "java.j2_macro" as m with context %} | ||
package me.opc.mp.database; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.ws.rs.*; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.inject.*; | ||
{{ m.import() }} | ||
|
||
/** | ||
* Dept Table | ||
*/ | ||
@Path("/") | ||
public class DeptResource { | ||
@Inject | ||
private DeptRepository deptRepository; | ||
|
||
@GET | ||
@Path("dept") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<Dept> getDept() throws Exception { | ||
return deptRepository.findAll().toList(); | ||
} | ||
|
||
@GET | ||
@Path("info") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String getInfo() { | ||
return "Java - Helidon - {{ dbName }}"; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
option/src/app/java_helidon4_nosql/src/main/java/me/opc/mp/database/FieldAccessStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package me.opc.mp.database; | ||
|
||
import jakarta.json.bind.config.PropertyVisibilityStrategy; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
|
||
public class FieldAccessStrategy implements PropertyVisibilityStrategy { | ||
@Override | ||
public boolean isVisible(Field field) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isVisible(Method method) { | ||
return true; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
option/src/app/java_helidon4_nosql/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Oracle NoSQL Configuration | ||
jnosql: | ||
keyvalue: | ||
database: beers | ||
document: | ||
database: beers | ||
oracle: | ||
nosql: | ||
host: http://localhost:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters