jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
206 stars 59 forks source link

Clarify definition of basic type #120

Closed lukasj closed 2 years ago

lukasj commented 9 years ago

The term basic type is used throughout the specification, but it is not clearly defined.

Section 11.1.6 Basic Annotation reads

The Basic annotation can be applied to a persistent property or instance variable of any of the following types: Java primitive types, wrappers of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[], enums, and any other type that implements Serializable.

Is the intended meaning:

A basic type is any of the following types. [insert list]. The tt>@Basic</tt annotation can be applied to any basic type. The use of this annotation is optional.

A mapping exception shall be raised when the tt>@Basic</tt annotation is applied to any non-basic type.

Affected Versions

[2.2]

lukasj commented 6 years ago
lukasj commented 9 years ago

@glassfishrobot Commented Reported by hwellmann

lukasj commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-120

m-reza-rahman commented 3 years ago

This looks like a good candidate for a community/end-user contribution. I would suggest marking it with "good first issue" and/or "help wanted". That will help facilitate recruiting people to contribute. I would honestly also mark this low priority.

Reza Rahman Jakarta EE Ambassador, Author, Blogger, Speaker

Please note views expressed here are my own as an individual community member and do not reflect the views of my employer.

Tomas-Kraus commented 2 years ago

I would just reuse and slightly modify definition from section 2.8: If the type of the field or property is one of the following, it is mapped in the same way as it would if it were annotated as Basic: Java primitive types, wrappers of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime, java.time.OffsetTime, java.time.OffsetDateTime, byte[], Byte[], char[], Character[], enums, any other type that implements Serializable.

So we may add section 2.X, maybe just right before 2.6 where it's being used for the 1st time in the spec.

2.X Basic type

Basic type is any Java primitive type, wrapper of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime, java.time.OffsetTime, java.time.OffsetDateTime, byte[], Byte[], char[], Character[], enum, any other type that implements Serializable.

@lukasj @dazey3 What do you think about it?

lukasj commented 2 years ago

done