Supported Java Types

-

- When persisting a class, a persistence solution needs to know how to persist the types of
- each field in the class. Clearly a persistence solution can only support a finite number of
- Java types. It cannot know how to persist every possible type creatable. The JDO
- specifications define lists of types that are required to be supported by all implementations
- of those specifications. This support can be conveniently split into two parts
-

-

-

An object that can be referred-to (object reference, providing a relation) and that
- has an "identity" - First Class Object (FCO). JDO requires an implementation to
- support PersistenceCapable types, as well as object/interface fields that refer
- to PersistenceCapable objects.

-

An object that does not have an "identity" - Second Class Object (SCO). This is
- something like a String or Date field in a class. It can also be a Collection, that
- contains other objects.

-

-
-
-

First-Class (FCO) Types

-

- JDO requires objects that are PersistenceCapable to be FCO.
- In addition it supports persisting fields of Interface or java.lang.Object type as FCO
- (since these are just references to PersistenceCapable objects).
-

-
-

-
-

Second-Class (SCO) Types

-

- The table below shows the supported SCO java types in JDO2.
- The table also shows the default-fetch-group (DFG) setting for that Java type (so
- whether it is retrieved by default when retrieving an object with a field of that type),
- whether the field is persisted by default (if it is "false" then you would have to add
- persistence-modifier="persistent" to the field for it to be persisted by JDO),
- and whether the java type can be used as part of the primary key.
-

-

-

-

Java Type

-

DFG?

-

Persistent?

-

PK?

-

-

-

boolean

-

-

-

-

-

-

byte

-

-

-

-

-

-

char

-

-

-

-

-

-

double

-

-

-

-

-

-

float

-

-

-

-

-

-

int

-

-

-

-

-

-

long

-

-

-

-

-

-

short

-

-

-

-

-

-

boolean[]

-

-

-

-

-

-

byte[]

-

-

-

-

-

-

char[]

-

-

-

-

-

-

double[]

-

-

-

-

-

-

float[]

-

-

-

-

-

-

int[]

-

-

-

-

-

-

long[]

-

-

-

-

-

-

short[]

-

-

-

-

-
-
-

-

java.lang.Boolean

-

-

-

-

-

-

java.lang.Byte

-

-

-

-

-

-

java.lang.Character

-

-

-

-

-

-

java.lang.Double

-

-

-

-

-

-

java.lang.Float

-

-

-

-

-

-

java.lang.Integer

-

-

-

-

-

-

java.lang.Long

-

-

-

-

-

-

java.lang.Short

-

-

-

-

-

-

java.lang.Boolean[]

-

-

-

-

-

-

java.lang.Byte[]

-

-

-

-

-

-

java.lang.Character[]

-

-

-

-

-

-

java.lang.Double[]

-

-

-

-

-

-

java.lang.Float[]

-

-

-

-

-

-

java.lang.Integer[]

-

-

-

-

-

-

java.lang.Long[]

-

-

-

-

-

-

java.lang.Short[]

-

-

-

-

-

-

java.lang.Number

-

-

-

-

-

-

java.lang.Object

-

-

-

-

-

-

java.lang.String

-

-

-

-

-

-

java.lang.String[]

-

-

-

-

-
-
-

-

java.math.BigDecimal

-

-

-

-

-

-

java.math.BigInteger

-

-

-

-

-

-

java.math.BigDecimal[]

-

-

-

-

-

-

java.math.BigInteger[]

-

-

-

-

-
-
-

-

java.sql.Date

-

-

-

-

-

-

java.sql.Time

-

-

-

-

-

-

java.sql.Timestamp

-

-

-

-

-
-
-

-

java.util.ArrayList

-

-

-

-

-

-

java.util.Collection

-

-

-

-

-

-

java.util.Currency

-

-

-

-

-

-

java.util.Date

-

-

-

-

-

-

java.util.Date[]

-

-

-

-

-

-

java.util.HashMap

-

-

-

-

-

-

java.util.HashSet

-

-

-

-

-

-

java.util.Hashtable

-

-

-

-

-

-

java.util.LinkedHashMap

-

-

-

-

-

-

java.util.LinkedHashSet

-

-

-

-

-

-

java.util.LinkedList

-

-

-

-

-

-

java.util.List

-

-

-

-

-

-

java.util.Locale

-

-

-

-

-

-

java.util.Locale[]

-

-

-

-

-

-

java.util.Map

-

-

-

-

-

-

java.util.Set

-

-

-

-

-

-

java.util.TreeMap

-

-

-

-

-

-

java.util.TreeSet

-

-

-

-

-

-

java.util.Vector

-

-

-

-

-
-

-

java.io.Serializable

-

-

-

-

-
-

-

javax.jdo.spi.PersistenceCapable

-

-

-

-

-

-

javax.jdo.spi.PersistenceCapable[]

-

-

-

-

-

-

java.lang.Enum

-

-

-

-

-

-

java.lang.Enum[]

-

-

-

-

-

-

-

-
+
+
+

Supported Java Types

+

+ When persisting a class, a persistence solution needs to know how to persist the types of
+ each field in the class. Clearly a persistence solution can only support a finite number of
+ Java types. It cannot know how to persist every possible type creatable. The JDO
+ specifications define lists of types that are required to be supported by all implementations
+ of those specifications. This support can be conveniently split into two parts
+

+

+

An object that can be referred-to (object reference, providing a relation) and that
+ has an "identity" - First Class Object (FCO). JDO requires an implementation to
+ support PersistenceCapable types, as well as object/interface fields that refer
+ to PersistenceCapable objects.

+

An object that does not have an "identity" - Second Class Object (SCO). This is
+ something like a String or Date field in a class. It can also be a Collection, that
+ contains other objects.

+

+
+
+

First-Class (FCO) Types

+

+ JDO requires objects that are PersistenceCapable to be FCO.
+ In addition it supports persisting fields of Interface or java.lang.Object type as FCO
+ (since these are just references to PersistenceCapable objects).
+

+
+

+
+

Second-Class (SCO) Types

+

+ The table below shows the supported SCO java types in JDO2.
+ The table also shows the default-fetch-group (DFG) setting for that Java type (so
+ whether it is retrieved by default when retrieving an object with a field of that type),
+ whether the field is persisted by default (if it is "false" then you would have to add
+ persistence-modifier="persistent" to the field for it to be persisted by JDO),
+ and whether the java type can be used as part of the primary key.
+

- Additional documentation and discussion can be found on the project
- wiki
-

-

- We have a communications conference call every Friday at 9:00 AM Pacific time. The conference call number is 866 230-6968 (international 865 544-7856) code 294-0479#. During this call we discuss project status, issues, concerns, and strategy. Everyone interested in Apache JDO is welcome and encouraged to participate.
-

+ Additional documentation and discussion can be found on the project
+ wiki
+

+

+ We have a communications conference call every Friday at 9:00 AM Pacific time. The conference call number is 866 230-6968 (international 865 544-7856) code 294-0479#. During this call we discuss project status, issues, concerns, and strategy. Everyone interested in Apache JDO is welcome and encouraged to participate.
+