Skip to content

[BUG] java.time.Instant values cannot be read #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
import jakarta.nosql.Entity;
import jakarta.nosql.Id;

import java.time.Instant;

@Entity
public record Failure(
@Id String id,
@Column byte[] data) {
@Column byte[] data,
@Column Instant instant) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import java.time.Instant;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -128,13 +129,14 @@ void shouldDeleteAll(){

@Test
void shouldInsertByteArray() {
var failure = new Failure("test", new byte[]{'a','b','c','d'});
var failure = new Failure("test", new byte[]{'a','b','c','d'}, Instant.now());
template.insert(failure);
Optional<Failure> entity = template.find(Failure.class, "test");
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(entity).isNotNull().isNotEmpty();
softly.assertThat(entity).map(Failure::id).get().isEqualTo("test");
softly.assertThat(entity).map(Failure::data).get().isEqualTo(failure.data());
softly.assertThat(entity).map(Failure::instant).get().isEqualTo(failure.instant());
});
}

Expand Down