I am trying to set up an entityclass with a postgres server. I need this database to store some images i upload with the primefaces < p:fileUpload/> tag. With this tag the images are uploaded as a UploadedFile, now I can access the contents via getContents() and I will get the image as a Bytearray (byte[] in Java) .

Now I need to know how can i save this Byte Array via the entityclasses in my postgres database. Postgres allows the datatype bytea for a column for this datatype, but if I add Bytearray as a type for the column in the entityclass AxonIvy throws this error: The field type 'Binary' does not support persistence.

So my question is:
Is there any possibility i can save bytearray or blobs on my postgres server via the entity class?
What are all the classes which support persistence?


asked 11.10.2018 at 11:00

markusinho's gravatar image

accept rate: 0%


This is not possible with the Entity Class Editor. But you can write your own Java Class:

package partner.protal.database;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;

public class NewsImages {

 private Integer id;

 private byte[] imageValue;

 private String imageNews;

 public Integer getId() {
  return id;

 public byte[] getImageValue() {
  return imageValue;

 public void setImageValue(byte[] imageValue) {
  this.imageValue = imageValue;

 public String getLongString() {
  return imageNews;

 public void setLongString(String longString) {
  this.imageNews = longString;

Java Entity Class in Designer


answered 24.10.2018 at 02:45

Christian%20Strebel's gravatar image

Christian St... ♦
accept rate: 88%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 11.10.2018 at 11:00

Seen: 496 times

Last updated: 24.10.2018 at 02:45