Skip to content

Commit

Permalink
Merge pull request #47 from JNOSQL/upgrade-jakarta-nosql-upgra
Browse files Browse the repository at this point in the history
Upgrade jakarta nosql upgra
  • Loading branch information
otaviojava authored May 26, 2024
2 parents 6ca3fb5 + d64ad82 commit f8188dd
Show file tree
Hide file tree
Showing 62 changed files with 153 additions and 109 deletions.
2 changes: 1 addition & 1 deletion arangodb-graph/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion arangodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
5 changes: 2 additions & 3 deletions arangodb/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.document.DocumentTemplate;
import net.datafaker.Faker;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Collections;
import java.util.List;

public class App {
Expand All @@ -26,7 +25,7 @@ public static void main(String[] args) {

try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
var faker = new Faker();
DocumentTemplate template = container.select(DocumentTemplate.class).get();
var template = container.select(DocumentTemplate.class).get();

Hero hero = template.insert(Hero.of(faker));

Expand Down
6 changes: 3 additions & 3 deletions arangodb/src/main/java/org/jnosql/demo/se/App1.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import net.datafaker.Faker;
import org.eclipse.jnosql.communication.document.DocumentQuery;
import org.eclipse.jnosql.databases.arangodb.mapping.ArangoDBTemplate;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import static org.eclipse.jnosql.communication.document.DocumentQuery.select;
import static org.eclipse.jnosql.communication.semistructured.SelectQuery.select;


public class App1 {

Expand All @@ -36,7 +36,7 @@ public static void main(String[] args) {
ArangoDBTemplate template = container.select(ArangoDBTemplate.class).get();
Hero hero = template.insert(Hero.of(faker));

DocumentQuery query = select().from("Hero").where("_key").eq("iron_man").build();
var query = select().from("Hero").where("_key").eq("iron_man").build();
List<Hero> heroes = template.<Hero>select(query).collect(Collectors.toList());
List<Hero> aql = template.<Hero>aql("FOR h IN Hero FILTER h.name == @id RETURN h", Collections.singletonMap("id", hero.name()))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.nosql.keyvalue.KeyValueTemplate;
import org.eclipse.jnosql.mapping.keyvalue.KeyValueTemplate;

import java.util.Optional;

Expand Down
2 changes: 1 addition & 1 deletion bean-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion bean-validation/src/main/java/org/jnosql/demo/se/Car.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import org.eclipse.jnosql.mapping.Convert;
import jakarta.nosql.Convert;
import org.jnosql.demo.se.converter.MonetaryAmountConverter;
import org.jnosql.demo.se.validation.CurrencyAccepted;
import org.jnosql.demo.se.validation.MonetaryMax;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.eclipse.jnosql.databases.mongodb.mapping.ObjectIdConverter;
import org.eclipse.jnosql.mapping.Convert;
import jakarta.nosql.Convert;

import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import org.bson.types.Decimal128;
import org.eclipse.jnosql.communication.TypeReference;
import org.eclipse.jnosql.communication.Value;
import org.eclipse.jnosql.communication.document.Document;
import org.eclipse.jnosql.mapping.AttributeConverter;
import jakarta.nosql.AttributeConverter;
import org.eclipse.jnosql.communication.semistructured.Element;
import org.javamoney.moneta.Money;

import javax.money.MonetaryAmount;
Expand Down Expand Up @@ -65,18 +65,18 @@ public MonetaryAmount convertToEntityAttribute(Object dbData) {
return getMonetaryAmount(bsonDocument);
}

if (dbData instanceof Document document) {
if (dbData instanceof Element document) {
return getMonetaryAmount(document);
}

return Money.of(BigDecimal.ZERO, DEFAULT_CURRENCY);

}

private MonetaryAmount getMonetaryAmount(Document document) {
private MonetaryAmount getMonetaryAmount(Element document) {

Map<String,Value> attributes = document.value()
.get(new TypeReference<List<Document>>() {})
.get(new TypeReference<List<Element>>() {})
.stream()
.map(d -> Map.of(d.name(), d.value()))
.reduce(new HashMap<>(), (a, b) -> {
Expand Down
2 changes: 1 addition & 1 deletion cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion cassandra/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.column.ColumnTemplate;
import org.eclipse.jnosql.databases.cassandra.mapping.CassandraTemplate;
import org.eclipse.jnosql.mapping.column.ColumnTemplate;

import java.util.Arrays;
import java.util.Optional;
Expand Down
4 changes: 1 addition & 3 deletions cassandra/src/main/java/org/jnosql/demo/se/Company.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.nosql.Column;
import jakarta.nosql.Entity;
import jakarta.nosql.Id;
import org.eclipse.jnosql.databases.cassandra.mapping.UDT;

import java.util.Collections;
import java.util.HashSet;
Expand All @@ -26,8 +25,7 @@ public class Company {
@Id("name")
private String name;

@Column
@UDT("headquarter")
@Column(udt = "headquarter")
private Set<Headquarter> headquarters;

/**
Expand Down
2 changes: 1 addition & 1 deletion cassandra/src/main/java/org/jnosql/demo/se/Money.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import jakarta.nosql.Column;
import jakarta.nosql.Entity;
import org.eclipse.jnosql.mapping.Convert;
import jakarta.nosql.Convert;

import java.math.BigDecimal;
import java.util.Currency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
package org.jnosql.demo.se;

import org.eclipse.jnosql.mapping.AttributeConverter;
import jakarta.nosql.AttributeConverter;

import java.util.Currency;

Expand Down
4 changes: 1 addition & 3 deletions cassandra/src/main/java/org/jnosql/demo/se/Movie.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import jakarta.nosql.Column;
import jakarta.nosql.Entity;
import org.eclipse.jnosql.databases.cassandra.mapping.UDT;

import java.util.Objects;

Expand All @@ -27,8 +26,7 @@ public class Movie {
@Column
private Integer age;

@Column
@UDT("director")
@Column(udt = "director")
private Director director;

public String getName() {
Expand Down
2 changes: 1 addition & 1 deletion couchbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion couchbase/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.document.DocumentTemplate;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Collections;
import java.util.List;
Expand Down
8 changes: 5 additions & 3 deletions couchbase/src/main/java/org/jnosql/demo/se/App1.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import org.eclipse.jnosql.communication.document.DocumentQuery;

import org.eclipse.jnosql.communication.semistructured.SelectQuery;
import org.eclipse.jnosql.databases.couchbase.mapping.CouchbaseTemplate;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import static org.eclipse.jnosql.communication.document.DocumentQuery.select;
import static org.eclipse.jnosql.communication.semistructured.SelectQuery.select;


public class App1 {

Expand All @@ -36,7 +38,7 @@ public static void main(String[] args) {
CouchbaseTemplate couchbaseTemplate = container.select(CouchbaseTemplate.class).get();
couchbaseTemplate.insert(ironMan);

DocumentQuery query = select().from("Hero").where("_id").eq("iron_man").build();
SelectQuery query = select().from("Hero").where("_id").eq("iron_man").build();
List<Hero> heroes = couchbaseTemplate.<Hero>select(query).collect(Collectors.toList());
System.out.println(heroes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.nosql.keyvalue.KeyValueTemplate;
import org.eclipse.jnosql.mapping.keyvalue.KeyValueTemplate;


import java.util.Optional;

Expand Down
2 changes: 1 addition & 1 deletion couchdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion couchdb/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.document.DocumentTemplate;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Collections;
import java.util.List;
Expand Down
5 changes: 3 additions & 2 deletions couchdb/src/main/java/org/jnosql/demo/se/App2.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.PreparedStatement;
import jakarta.nosql.document.DocumentTemplate;
import org.eclipse.jnosql.mapping.PreparedStatement;

import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Collections;
import java.util.List;
Expand Down
2 changes: 1 addition & 1 deletion couchdb/src/main/java/org/jnosql/demo/se/App4.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.document.DocumentTemplate;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Collections;
import java.util.Map;
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/main/java/org/jnosql/demo/se/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@


import jakarta.nosql.Column;
import org.eclipse.jnosql.mapping.Embeddable;

import jakarta.nosql.Embeddable;

import java.util.Objects;

Expand Down
8 changes: 4 additions & 4 deletions elasticsearch/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.document.DocumentTemplate;
import org.eclipse.jnosql.communication.document.DocumentQuery;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;

import java.util.Arrays;
import java.util.Optional;
import java.util.Random;

import static org.eclipse.jnosql.communication.document.DocumentQuery.select;
import static org.eclipse.jnosql.communication.semistructured.SelectQuery.select;


public class App {

Expand Down Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) {
System.out.println("Developer saved" + saved);


DocumentQuery query = select().from("developer")
var query = select().from("developer")
.where("_id").eq(id).build();

Optional<Developer> optional = template.select(Developer.class).where("id")
Expand Down
2 changes: 1 addition & 1 deletion hazelcast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion hazelcast/src/main/java/org/jnosql/demo/se/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.nosql.keyvalue.KeyValueTemplate;
import org.eclipse.jnosql.mapping.keyvalue.KeyValueTemplate;

import java.util.Arrays;
import java.util.Optional;
Expand Down
1 change: 0 additions & 1 deletion hazelcast/src/main/java/org/jnosql/demo/se/App2.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public static void main(String[] args) {
repository.save(USER);
Optional<User> user = repository.findById("username");
System.out.println("User found: " + user);
System.out.println("The user found: " + repository.existsById("username"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion janus-graph/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>mapping-demo-java-se</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
*/
package org.jnosql.demo.se;

import jakarta.data.repository.PageableRepository;
import jakarta.data.repository.BasicRepository;
import jakarta.data.repository.Repository;

import java.util.stream.Stream;

@Repository
public interface PersonRepository extends PageableRepository<Person, Long> {
public interface PersonRepository extends BasicRepository<Person, Long> {

Stream<Person> findByOccupationAndSalaryGreaterThan(String ocuppation, Double salary);

Expand Down
Loading

0 comments on commit f8188dd

Please sign in to comment.