0

I know that by default plays JPA implementation uses DB to store references to BLOBs stored in file system, and I haven't found, by this far, any way to switch this behaviour. - Is it possible somehow? If yes, how?

My specyfic use case requires storing content of large text files inside DB to make access to them as fast as possible.

biesior
  • 55,576
  • 10
  • 125
  • 182
dantuch
  • 9,123
  • 6
  • 45
  • 68

2 Answers2

1

The correct way to do this is to use the @javax.persistence.Lob annotation.

There was a bug raised that the documentation does not cover the use case of saving data to a DB instead of a filesystem. The resolution to the bug was to point the asker to the following source code...

https://gist.github.com/1275419

Codemwnci
  • 54,176
  • 10
  • 96
  • 129
0

I based my solution for images on this gist and it works pretty well.

https://gist.github.com/660937

You can also store bytes if you need, look at this other SO question.

How is a blob column annotated in Hibernate?

Hope it helps.

Community
  • 1
  • 1
mericano1
  • 2,914
  • 1
  • 18
  • 25