- Fix OID for Time (Issue #125)
- Fixed Quoting Issues raised in Issue #118. Thanks to @krisse7 for PR #120!
- Moved entire code into a single project, remove multi modules.
- Re-added support for primtive data types, but used method names:
AbstractMapping#mapBooleanPrimitive
AbstractMapping#mapBytePrimitive
AbstractMapping#mapShortPrimtive
AbstractMapping#mapIntegerPrimitive
AbstractMapping#mapFloatPrimitive
AbstractMapping#mapDoublePrimitive
- The
JpaMapping<>
has been dropped from the library.
- Adding
SimpleRow#setTime
for mappingLocalTime
This release saw major improvements and some breaking changes. The release is a dramatic improvement of the library, because it adds:
- Java11 support
- Improved Type Safety
- Internal Refactorings to improve maintainability
- Build Pipelines
- Code Coverage
- Dependency updates
All of this great work was done by @jonfreedman.
There is a major change in how the library is released. The project now
targets both Java8 and Java11. You are able to use the JDK8 version by
using the jdk8
classifier.
So for Java8 you have to use the following dependencies:
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-core</artifactId>
<version>6.0.0</version>
<classifier>jdk8</classifier>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-rowwriter</artifactId>
<version>6.0.0</version>
<classifier>jdk8</classifier>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-jpa</artifactId>
<version>6.0.0</version>
<classifier>jdk8</classifier>
</dependency>
For Java11 you have to use the following dependencies:
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-core</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-rowwriter</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-jpa</artifactId>
<version>6.0.0</version>
</dependency>
PgBinaryWriter#open
removed and now opened in constructorSimpleRowWriter#open
removed and now opened in constructorSimpleRowWriter
now implements theAutoClosable
interface, so it can be used in try-with-resources blocks.PostgreSqlUtils#tryGetPGConnection
now returns anOptional
BulkProcessor#cancel
static method removed
- Static Analysis has been added to the project using Error Prone
- Integration Tests are now run on every commit using Github Pipelines and the Postgres image.
- There have been a lot of refactorings internally, so the overall maintainability is improved.
- The project now has a Code Coverage report, so you get a feeling about the test coverage.
- The README now has badges, so it is easier to see the latest stable release.
- The project has been moved to an organization structure, so it easier to assign rights and collaborate.
This release saw additions and refactorings of the JPA module. It now supports a lot more
data types and is easier to configure by using annotations. If you want control over how
the data is written to the database, you can use the @PostgresDataType
annotation,
which overrides the default values.
Here is an example for mapping a short
value to an int4
Postgres data type.
@Entity
@Table(name = "unit_test", schema = "public")
public static class SampleEntity {
// ...
@Column(name = "some_field_name")
@PostgresDataType(columnName = "some_field_name", dataType = DataType.Int4)
private Short shortField;
public Short getShortField() {
return shortField;
}
public void setShortField(Short shortField) {
this.shortField = shortField;
}
}
A lot of thanks to the great efforts of user @cheffe in this release!
This release sees some major and breaking changes:
- Introducing Semantic Versioning with
major.minor.bugfix
starting with 5.0.0. - Split the project into multiple modules to provide a stable core and build modules around it:
- Moving the
SimpleRowWriter
to modulepgbulkinsert-rowwriter
- Moving the
BulkProcessor
to modulepgbulkinsert-bulkprocessor
- Creating a new module
pgbulkinsert-jpa
to better integrate with existing JPA mappings.
- Moving the
- Added a new mapping
JpaMapping
to modulepgbulkinsert-jpa
, which provides a better JPA integration: - Made it easier to run the tests for the projects by introducing a properties file.
From now on the groupId
is de.bytefish.pgbulkinsert
and all dependencies can be installed from Central Maven Repositories as:
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-core</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-rowwriter</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>de.bytefish.pgbulkinsert</groupId>
<artifactId>pgbulkinsert-jpa</artifactId>
<version>5.0.0</version>
</dependency>
- Simplified Quoting identifiers for the
SimpleRowWriter
Added support for Range Types:
- int4range
- int8range
- numrange
- tsrange
- tstzrange
- daterange
Thanks to @csimplestring for help and valuable feedback!
- Bugfixes for the Range Type
- Added support for Ranges, such as
tstzrange
. Thanks to @csimplestring for the Feature request!- Use
mapTsTzRange
if you are using theAbstractMapping
- Use
setTsTzRange
if you are using theSimpleRowWriter
- Use
- Many improvements added by @tangyibo!
- Closing the Stream of the
SimpleRowWriter
, so it doesn't block anymore. - Improved error logging to get to the underlying cause of the error in the JDBC driver.
- Added Null Character Handling, so Null Bytes (
0x00
) do not crash theCOPY
- Closing the Stream of the
You can enable the Null Character Handling like this. It removes all 0x00
occurences and replaces them with an empty string:
// Create the Table Definition:
SimpleRowWriter.Table table = new SimpleRowWriter.Table(schema, tableName, columnNames);
// Create the Writer:
SimpleRowWriter writer = new SimpleRowWriter(table);
// Enable the Null Character Handler:
writer.enableNullCharacterHandler();
If you need to customize the Null Character Handling, then you can use the setNullCharacterHandler(Function<String, String> nullCharacterHandler)
function.
- Updates the PostgreSQL JDBC driver to Version
42.2.9
.
- Improving the
ZonedDateTime
handling.
- @robsonbittencourt reported a severe bug in the Numeric Value handling. Everyone should update to 3.3!
- @kowalczm further improved the
ByteArrayValueHandler
in Pull Request #29.
- Thanks to @kowalczm for adding support for primitive types (
byte
,int
,float
,double
, ...), see Pull Request #27. This makes boxing primitive types unnecessary now and will make it easier to integrate the library into existing applications.
- The library now uses the standard functional interfaces of Java, see Pull Request #24. The
ByteArrayValueHandler
now uses primitive Byte Arrays (byte[]
), which makes boxing unnecessary. This was a breaking change in the API and as such, the major revision was increased to 3.0. - An overloaded
saveAll
method has been added by @kowalczm in Pull Request #25. You can now save aCollection
instead of being forced to use streams.
- Thanks to @momania for fixing Issue #20, which was a severe bug with the mapping procedures. This led to improvements for the
AbstractMapping
API now exposing almost all types as arrays.
- Issue #16 updates the PostgreSQL JDBC driver to Version
42.2.2
. A configurable buffer size was added to the API for improving the throughput to PostgreSQL. Thanks to @kowalczm for both improvements.
- Pull Request #19 was a major refactoring of the API by creating an
AbstractMapping
. This now separates the Mapping and the actual saving, making it possible (and easier) to reuse the PgBulkInsert Mapping API as a standalone implementation. As a major breaking change, the major revision has been set to 2.0. Thanks to @The-Alchemist for raising the issue and making improvements to the library.
- Issue #10 added support for the Numeric Data Type to the API. Thanks to @li-xiangdong for raising the issue.
- Commit b4543db restructured the Value Handler API, which was an internal implementation detail, so the major revision wasn't increased.
- Added Geometric Data Types, JSONB.
- Initial Release.