You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/05/23 09:51:41 UTC
[isis] branch master updated: ISIS-2513: fixing some demo jpa
entities, also provide image converter
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new d619609 ISIS-2513: fixing some demo jpa entities, also provide image converter
d619609 is described below
commit d619609d23e7b489467f106accccf5e9e58f231b
Author: andi-huber <ah...@apache.org>
AuthorDate: Sun May 23 11:51:27 2021 +0200
ISIS-2513: fixing some demo jpa entities, also provide image converter
---
.../dom/types/isis/blobs/jpa/IsisBlobJpa.java | 54 +++++++++---------
.../dom/types/isis/clobs/jpa/IsisClobJpa.java | 66 +++++++++++-----------
.../jpa/IsisLocalResourcePathJpa.java | 13 ++---
.../dom/types/isis/markups/jpa/IsisMarkupJpa.java | 13 +++--
.../types/isis/passwords/jpa/IsisPasswordJpa.java | 10 ++--
.../isisext/asciidocs/jpa/IsisAsciiDocJpa.java | 13 +++--
.../isisext/markdowns/jpa/IsisMarkdownJpa.java | 13 +++--
.../images/jpa/JavaAwtBufferedImageJpa.java | 16 ++++--
.../jpa/integration/IsisModuleJpaIntegration.java | 5 +-
.../JavaAwtBufferedImageByteArrayConverter.java | 44 +++++++++++++++
.../jdo/dn5/converters/IsisMarkdownConverter.java | 3 -
.../jpa/converters/IsisMarkdownConverter.java | 2 +
12 files changed, 153 insertions(+), 99 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/blobs/jpa/IsisBlobJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/blobs/jpa/IsisBlobJpa.java
index fbd632b..0de815c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/blobs/jpa/IsisBlobJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/blobs/jpa/IsisBlobJpa.java
@@ -18,8 +18,6 @@
*/
package demoapp.dom.types.isis.blobs.jpa;
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Persistent;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
@@ -70,47 +68,47 @@ public class IsisBlobJpa
@Title(prepend = "Blob JPA entity: ")
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = { // <.>
- @Column(name = "readOnlyProperty_name"),
- @Column(name = "readOnlyProperty_mimetype"),
- @Column(name = "readOnlyProperty_bytes")
- })
+// @Persistent(defaultFetchGroup="false", columns = { // <.>
+// @Column(name = "readOnlyProperty_name"),
+// @Column(name = "readOnlyProperty_mimetype"),
+// @Column(name = "readOnlyProperty_bytes")
+// })
@Getter @Setter
private Blob readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readWriteProperty_name"),
- @Column(name = "readWriteProperty_mimetype"),
- @Column(name = "readWriteProperty_bytes")
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readWriteProperty_name"),
+// @Column(name = "readWriteProperty_mimetype"),
+// @Column(name = "readWriteProperty_bytes")
+// })
@Getter @Setter
private Blob readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readOnlyOptionalProperty_name",
- allowsNull = "true"), // <.>
- @Column(name = "readOnlyOptionalProperty_mimetype",
- allowsNull = "true"),
- @Column(name = "readOnlyOptionalProperty_bytes",
- allowsNull = "true")
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readOnlyOptionalProperty_name",
+// allowsNull = "true"), // <.>
+// @Column(name = "readOnlyOptionalProperty_mimetype",
+// allowsNull = "true"),
+// @Column(name = "readOnlyOptionalProperty_bytes",
+// allowsNull = "true")
+// })
@Getter @Setter
private Blob readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readWriteOptionalProperty_name",
- allowsNull = "true"),
- @Column(name = "readWriteOptionalProperty_mimetype",
- allowsNull = "true"),
- @Column(name = "readWriteOptionalProperty_bytes",
- allowsNull = "true")
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readWriteOptionalProperty_name",
+// allowsNull = "true"),
+// @Column(name = "readWriteOptionalProperty_mimetype",
+// allowsNull = "true"),
+// @Column(name = "readWriteOptionalProperty_bytes",
+// allowsNull = "true")
+// })
@Getter @Setter
private Blob readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/clobs/jpa/IsisClobJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/clobs/jpa/IsisClobJpa.java
index 3784fd4..bbcc0f0 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/clobs/jpa/IsisClobJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/clobs/jpa/IsisClobJpa.java
@@ -18,8 +18,6 @@
*/
package demoapp.dom.types.isis.clobs.jpa;
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Persistent;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
@@ -70,53 +68,53 @@ public class IsisClobJpa
@Title(prepend = "Clob JPA entity: ")
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = { // <.>
- @Column(name = "readOnlyProperty_name"),
- @Column(name = "readOnlyProperty_mimetype"),
- @Column(name = "readOnlyProperty_chars"
- , jdbcType = "CLOB"
- )
- })
+// @Persistent(defaultFetchGroup="false", columns = { // <.>
+// @Column(name = "readOnlyProperty_name"),
+// @Column(name = "readOnlyProperty_mimetype"),
+// @Column(name = "readOnlyProperty_chars"
+// , jdbcType = "CLOB"
+// )
+// })
@Getter @Setter
private Clob readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readWriteProperty_name"),
- @Column(name = "readWriteProperty_mimetype"),
- @Column(name = "readWriteProperty_chars"
- , jdbcType = "CLOB"
- )
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readWriteProperty_name"),
+// @Column(name = "readWriteProperty_mimetype"),
+// @Column(name = "readWriteProperty_chars"
+// , jdbcType = "CLOB"
+// )
+// })
@Getter @Setter
private Clob readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readOnlyOptionalProperty_name",
- allowsNull = "true"), // <.>
- @Column(name = "readOnlyOptionalProperty_mimetype",
- allowsNull = "true"),
- @Column(name = "readOnlyOptionalProperty_chars"
- , jdbcType = "CLOB"
- , allowsNull = "true")
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readOnlyOptionalProperty_name",
+// allowsNull = "true"), // <.>
+// @Column(name = "readOnlyOptionalProperty_mimetype",
+// allowsNull = "true"),
+// @Column(name = "readOnlyOptionalProperty_chars"
+// , jdbcType = "CLOB"
+// , allowsNull = "true")
+// })
@Getter @Setter
private Clob readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
- @Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "readWriteOptionalProperty_name"
- , allowsNull = "true"), // <.>
- @Column(name = "readWriteOptionalProperty_mimetype"
- , allowsNull = "true"),
- @Column(name = "readWriteOptionalProperty_bytes"
- , jdbcType = "CLOB"
- , allowsNull = "true")
- })
+// @Persistent(defaultFetchGroup="false", columns = {
+// @Column(name = "readWriteOptionalProperty_name"
+// , allowsNull = "true"), // <.>
+// @Column(name = "readWriteOptionalProperty_mimetype"
+// , allowsNull = "true"),
+// @Column(name = "readWriteOptionalProperty_bytes"
+// , jdbcType = "CLOB"
+// , allowsNull = "true")
+// })
@Getter @Setter
private Clob readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/localresourcepaths/jpa/IsisLocalResourcePathJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/localresourcepaths/jpa/IsisLocalResourcePathJpa.java
index a51a93e..09f2126 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/localresourcepaths/jpa/IsisLocalResourcePathJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/localresourcepaths/jpa/IsisLocalResourcePathJpa.java
@@ -18,8 +18,7 @@
*/
package demoapp.dom.types.isis.localresourcepaths.jpa;
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.NotPersistent;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
@@ -70,26 +69,26 @@ public class IsisLocalResourcePathJpa
@Title(prepend = "LocalResourcePath JPA entity: ")
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false") // <.>
+ @Column(nullable = false) // <.>
@Getter @Setter
private LocalResourcePath readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
- @Column(allowsNull = "false")
+ @Column(nullable = false)
@Getter @Setter
private LocalResourcePath readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) // <.>
@Getter @Setter
private LocalResourcePath readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
- @NotPersistent
- // @Column(allowsNull = "true")
+ @javax.persistence.Transient
+ // @Column(nullable = true)
@Getter @Setter
private LocalResourcePath readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/markups/jpa/IsisMarkupJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/markups/jpa/IsisMarkupJpa.java
index cbb6073..fabc964 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/markups/jpa/IsisMarkupJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/markups/jpa/IsisMarkupJpa.java
@@ -19,11 +19,14 @@
package demoapp.dom.types.isis.markups.jpa;
import javax.inject.Inject;
-import javax.jdo.annotations.Column;
+import javax.persistence.Basic;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.Table;
import org.springframework.context.annotation.Profile;
@@ -75,25 +78,25 @@ public class IsisMarkupJpa
}
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB") // <.>
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private Markup readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "editable-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB")
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private Markup readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private Markup readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "2")
- @Column(allowsNull = "true")
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private Markup readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/passwords/jpa/IsisPasswordJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/passwords/jpa/IsisPasswordJpa.java
index 6af3acc..58ade67 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isis/passwords/jpa/IsisPasswordJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isis/passwords/jpa/IsisPasswordJpa.java
@@ -18,7 +18,7 @@
*/
package demoapp.dom.types.isis.passwords.jpa;
-import javax.jdo.annotations.Column;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
@@ -69,25 +69,25 @@ public class IsisPasswordJpa
@Title(prepend = "Password JPA entity: ")
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false") // <.>
+ @Column(nullable = false) // <.>
@Getter @Setter
private Password readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
- @Column(allowsNull = "false")
+ @Column(nullable = false)
@Getter @Setter
private Password readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) // <.>
@Getter @Setter
private Password readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
- @Column(allowsNull = "true")
+ @Column(nullable = true)
@Getter @Setter
private Password readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/asciidocs/jpa/IsisAsciiDocJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/asciidocs/jpa/IsisAsciiDocJpa.java
index 7a8b453..edbec7d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/asciidocs/jpa/IsisAsciiDocJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/asciidocs/jpa/IsisAsciiDocJpa.java
@@ -19,11 +19,14 @@
package demoapp.dom.types.isisext.asciidocs.jpa;
import javax.inject.Inject;
-import javax.jdo.annotations.Column;
+import javax.persistence.Basic;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.Table;
import org.springframework.context.annotation.Profile;
@@ -75,25 +78,25 @@ public class IsisAsciiDocJpa
}
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB") // <.>
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private AsciiDoc readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "editable-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB")
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private AsciiDoc readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private AsciiDoc readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "2")
- @Column(allowsNull = "true")
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private AsciiDoc readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/markdowns/jpa/IsisMarkdownJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/markdowns/jpa/IsisMarkdownJpa.java
index ad3e04f..d0f7447 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/markdowns/jpa/IsisMarkdownJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/isisext/markdowns/jpa/IsisMarkdownJpa.java
@@ -19,11 +19,14 @@
package demoapp.dom.types.isisext.markdowns.jpa;
import javax.inject.Inject;
-import javax.jdo.annotations.Column;
+import javax.persistence.Basic;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.Table;
import org.springframework.context.annotation.Profile;
@@ -75,25 +78,25 @@ public class IsisMarkdownJpa
}
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB") // <.>
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private Markdown readOnlyProperty;
@Property(editing = Editing.ENABLED) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "editable-properties", sequence = "1")
- @Column(allowsNull = "false", jdbcType = "CLOB")
+ @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private Markdown readWriteProperty;
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY) // <.>
@Getter @Setter
private Markdown readOnlyOptionalProperty;
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@PropertyLayout(hidden = Where.ALL_TABLES, fieldSetId = "optional-properties", sequence = "2")
- @Column(allowsNull = "true")
+ @Column(nullable = true) @Lob @Basic(fetch=FetchType.LAZY)
@Getter @Setter
private Markdown readWriteOptionalProperty;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javaawt/images/jpa/JavaAwtBufferedImageJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javaawt/images/jpa/JavaAwtBufferedImageJpa.java
index 9ee94ea..583c1a2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javaawt/images/jpa/JavaAwtBufferedImageJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javaawt/images/jpa/JavaAwtBufferedImageJpa.java
@@ -20,7 +20,8 @@ package demoapp.dom.types.javaawt.images.jpa;
import java.awt.image.BufferedImage;
-import javax.jdo.annotations.Column;
+import javax.persistence.Column;
+import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
@@ -34,6 +35,7 @@ import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.persistence.jpa.applib.integration.JpaEntityInjectionPointResolver;
+import org.apache.isis.persistence.jpa.integration.typeconverters.JavaAwtBufferedImageByteArrayConverter;
import demoapp.dom.types.javaawt.images.persistence.JavaAwtBufferedImageEntity;
import lombok.Getter;
@@ -70,14 +72,15 @@ public class JavaAwtBufferedImageJpa
return "Image JPA entity";
}
- // @Title(prepend = "Image JDO entity: ") // not yet supported
+ // @Title(prepend = "Image JPA entity: ") // not yet supported
//tag::class[]
@Id
@GeneratedValue
private Long id;
@PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
- @Column(allowsNull = "false") // <.>
+ @Column(nullable = false) // <.>
+ @Convert(converter = JavaAwtBufferedImageByteArrayConverter.class)
@Getter @Setter
private BufferedImage readOnlyProperty;
@@ -91,14 +94,15 @@ public class JavaAwtBufferedImageJpa
// editable properties not yet supported:
// @Property(editing = Editing.ENABLED) // <.>
// @PropertyLayout(group = "editable-properties", sequence = "1")
-// @Column(allowsNull = "false")
+// @Column(nullable = false)
// @Getter @Setter
// private BufferedImage readWriteProperty;
//tag::class[]
@Property(optionality = Optionality.OPTIONAL) // <.>
@PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
- @Column(allowsNull = "true") // <.>
+ @Column(nullable = true) // <.>
+ @Convert(converter = JavaAwtBufferedImageByteArrayConverter.class)
@Getter @Setter
private BufferedImage readOnlyOptionalProperty;
@@ -106,7 +110,7 @@ public class JavaAwtBufferedImageJpa
// editable properties not yet supported:
// @Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
// @PropertyLayout(group = "optional-properties", sequence = "2")
-// @Column(allowsNull = "true")
+// @Column(nullable = true)
// @Getter @Setter
// private BufferedImage readWriteOptionalProperty;
diff --git a/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/IsisModuleJpaIntegration.java b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/IsisModuleJpaIntegration.java
index 18c14fd..37ffaa6 100644
--- a/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/IsisModuleJpaIntegration.java
+++ b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/IsisModuleJpaIntegration.java
@@ -24,6 +24,7 @@ import org.springframework.context.annotation.Import;
import org.apache.isis.core.runtime.IsisModuleCoreRuntime;
import org.apache.isis.persistence.jpa.integration.metamodel.JpaProgrammingModel;
import org.apache.isis.persistence.jpa.integration.services.JpaSupportServiceUsingSpring;
+import org.apache.isis.persistence.jpa.integration.typeconverters.JavaAwtBufferedImageByteArrayConverter;
@Configuration
@Import({
@@ -37,6 +38,9 @@ import org.apache.isis.persistence.jpa.integration.services.JpaSupportServiceUsi
// @Service's
JpaSupportServiceUsingSpring.class,
+ // @Converter's
+ JavaAwtBufferedImageByteArrayConverter.class,
+
// DataNucleusSettings.class,
// ExceptionRecognizerForSQLIntegrityConstraintViolationUniqueOrIndexException.class,
// ExceptionRecognizerForJDODataStoreExceptionIntegrityConstraintViolationForeignKeyNoActionException.class,
@@ -50,7 +54,6 @@ import org.apache.isis.persistence.jpa.integration.services.JpaSupportServiceUsi
// JdoMetamodelMenu.class,
//
// // @Mixin's
-// Persistable_datanucleusIdLong.class,
// Persistable_datanucleusVersionLong.class,
// Persistable_datanucleusVersionTimestamp.class,
// Persistable_downloadJdoMetadata.class,
diff --git a/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/typeconverters/JavaAwtBufferedImageByteArrayConverter.java b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/typeconverters/JavaAwtBufferedImageByteArrayConverter.java
new file mode 100644
index 0000000..e34a80e
--- /dev/null
+++ b/persistence/jpa/integration/src/main/java/org/apache/isis/persistence/jpa/integration/typeconverters/JavaAwtBufferedImageByteArrayConverter.java
@@ -0,0 +1,44 @@
+package org.apache.isis.persistence.jpa.integration.typeconverters;
+
+import java.awt.image.BufferedImage;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+import org.apache.isis.commons.internal.base._NullSafe;
+import org.apache.isis.commons.internal.image._Images;
+
+/**
+ * @since 2.0 {@index}
+ */
+@Converter
+public class JavaAwtBufferedImageByteArrayConverter implements AttributeConverter<BufferedImage, byte[]> {
+
+ @Override
+ public byte[] convertToDatabaseColumn(BufferedImage memberValue) {
+ if (memberValue == null) {
+ return null;
+ }
+ try {
+ return _Images.toBytes(memberValue);
+ } catch (Exception e) {
+ throw new javax.persistence.PersistenceException(
+ "Error serialising object of type BufferedImage to byte array", e);
+ }
+ }
+
+ @Override
+ public BufferedImage convertToEntityAttribute(byte[] datastoreValue) {
+ if (_NullSafe.size(datastoreValue) == 0) {
+ return null;
+ }
+ try {
+ return _Images.fromBytes(datastoreValue);
+ } catch (Exception e) {
+ throw new javax.persistence.PersistenceException(
+ "Error deserialising image datastoreValue", e);
+ }
+ }
+
+}
+
diff --git a/valuetypes/markdown/persistence/jdo-dn5/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jdo/dn5/converters/IsisMarkdownConverter.java b/valuetypes/markdown/persistence/jdo-dn5/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jdo/dn5/converters/IsisMarkdownConverter.java
index 8606303..0d3e8a9 100644
--- a/valuetypes/markdown/persistence/jdo-dn5/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jdo/dn5/converters/IsisMarkdownConverter.java
+++ b/valuetypes/markdown/persistence/jdo-dn5/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jdo/dn5/converters/IsisMarkdownConverter.java
@@ -18,8 +18,6 @@
*/
package org.apache.isis.valuetypes.markdown.persistence.jdo.dn5.converters;
-import javax.persistence.Converter;
-
import org.datanucleus.store.types.converters.TypeConverter;
import org.apache.isis.valuetypes.markdown.applib.value.Markdown;
@@ -27,7 +25,6 @@ import org.apache.isis.valuetypes.markdown.applib.value.Markdown;
/**
* @since 2.0 {@index}
*/
-@Converter
public class IsisMarkdownConverter implements TypeConverter<Markdown, String>{
private static final long serialVersionUID = 1L;
diff --git a/valuetypes/markdown/persistence/jpa/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jpa/converters/IsisMarkdownConverter.java b/valuetypes/markdown/persistence/jpa/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jpa/converters/IsisMarkdownConverter.java
index 19d5c1a..cb47de6 100644
--- a/valuetypes/markdown/persistence/jpa/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jpa/converters/IsisMarkdownConverter.java
+++ b/valuetypes/markdown/persistence/jpa/src/main/java/org/apache/isis/valuetypes/markdown/persistence/jpa/converters/IsisMarkdownConverter.java
@@ -19,12 +19,14 @@
package org.apache.isis.valuetypes.markdown.persistence.jpa.converters;
import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
import org.apache.isis.valuetypes.markdown.applib.value.Markdown;
/**
* @since 2.0 {@index}
*/
+@Converter
public class IsisMarkdownConverter implements AttributeConverter<Markdown, String>{
@Override