Skip to content

Commit

Permalink
docs: update UUID
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Feb 16, 2024
1 parent 4c17d76 commit 6b764b5
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions spec/src/main/asciidoc/chapters/api/entity.adoc
Expand Up @@ -102,16 +102,20 @@ For example, the following entity class has five basic fields:
public class Person {
@Id
private UUID id;
@Column
private String name;
@Column
private long ssn;
@Column
private LocalDate birthdate;
@Column
private byte[] photo;
}
----

In addition to the types listed above, an entity programming model might support additional domain-specific basic types. This extended set of basic types might include types with a nontrivial internal structure. An entity programming model might even provide mechanisms to convert between user-written types and natively-supported basic types, defined at the `AttributeConverter` interface.

NOTE: Many key-value, wide-column, document, and relational databases feature native support for arrays or even associative arrays of these basic types. Unfortunately, the semantics of such types--along with their performance characteristics--are extremely nonuniform, and so support for such types is left undefined by the Jakarta NoSQL specification.
NOTE: Many key-value, wide-column, and document databases feature native support for arrays or even associative arrays of these basic types.

==== Embedded Fields and Embeddable Classes

Expand Down Expand Up @@ -142,16 +146,21 @@ For example, consider the following Java classes:
----
@Embeddable
public class Address {
@Column
private String street;
@Column
private String city;
@Column
private String postalCode;
}
@Entity
public class Person {
@Id
private Long id;
@Column
private String name;
@Column
private Address address; // embedded field
}
----
Expand Down Expand Up @@ -204,17 +213,38 @@ For example, consider the following Java classes:
public class Author {
@Id
private UUID id;
@Column
private String name;
@Column
private List<Book> books;
}
@Entity
public class Book {
@Id
private Long id;
@Column
private String title;
@Column
private String category;
private List<Author> authors;
}
----

For example, the JSON representation of `Author` might be:

[source,json]
----
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "John Smith",
"books": [
{
"title": "Java Programming",
"category": "Programming"
},
{
"title": "Introduction to NoSQL",
"category": "Database"
}
]
}
----

Expand Down

0 comments on commit 6b764b5

Please sign in to comment.