You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ohad Shai edited this page Dec 12, 2022
·
4 revisions
Supported Java types and their destination types on PostgreSQL
All types also support their array versions, but they are returned as IndexedSeq of the type and not
pure Array types.
PostgreSQL type
Java type
boolean
Boolean
smallint
Short
integer (or serial)
Int
bigint (or bigserial)
Long
numeric
BigDecimal
real
Float
double
Double
text
String
varchar
String
bpchar
String
timestamp
LocalDateTime
timestamp_with_timezone
DateTime
date
LocalDate
time
LocalTime
bytea
Array[Byte] (PostgreSQL 9.0 and above only)
All other types are returned as String.
Now from Scala/Java types to PostgreSQL types (when using prepared
statements):
Java type
PostgreSQL type
Boolean
boolean
Short
smallint
Int
integer
Long
bigint
Float
float
Double
double
BigInteger
numeric
BigDecimal
numeric
String
varchar
Array[Byte]
bytea (PostgreSQL 9.0 and above only)
java.nio.ByteBuffer
bytea (PostgreSQL 9.0 and above only)
io.netty.buffer.ByteBuf
bytea (PostgreSQL 9.0 and above only)
java.util.Date
timestamp_with_timezone
java.sql.Timestamp
timestamp_with_timezone
java.sql.Date
date
java.sql.Time
time
LocalDate
date
LocalDateTime
timestamp
DateTime
timestamp_with_timezone
LocalTime
time
Array types are encoded with the kind of object they hold and not the array type itself. Java Collection and
Scala Traversable objects are also assumed to be arrays of the types they hold and will be sent to PostgreSQL
like that.
null values are supported, In prepared statement pass null.
Spatial / Geometry data types (postgis<->jts) are supported via module jasync-postgis-jts. In order to use geometry types import the module and init with the following code: