How to write java.sql.Blob to JPA entity?

后端 未结 2 1333
野的像风
野的像风 2020-12-24 11:49

I have a JPA entity with java.sql.Blob:

@Entity
public class LargeData {

  @Lob
  private java.sql.Blob data;

  //getters/setters
}

How t

2条回答
  •  独厮守ぢ
    2020-12-24 12:24

    Use a byte array:

    @Lob
    @Column(length=100000)
    private byte[] data;
    

    If you want to use streams, create the blob using Hibernate.createBlob(..)

提交回复
热议问题