Lets say you get a LOB using an OID. Does the connection you initially read it
with need to stay open in order to get the stream? (If so, that will be a
challenge given the constraints of the JPA world). If not, what code would you
write to get the stream? Do you keep the stream open for a long period of time?
Do you need a connection for the duration of the time that you use it?
What I need is large files (not fit in RAM) to be part of a transaction when writing data. The streams won't be open for any longer than the time it takes to read/write the data.
I come from the Hibernate world and I'm heading for porting our app to EL as Hibernate gives us way too much trouble. But in order to do this I have a sample-app where I test stuff so that I'm sure stuff works the way I want before porting the app (~190K JAVA code and 90K Scala-code).
When it comes to handelign LOBs I need something like this:
For retreival:
doInTransaction{
MyEntity e = myRepository.find(PK)
StreamUtils.copy(e.getBlob.getBinaryStream, outputStream)
}
For creation (Hibernate pseudo-code):
doInTransaction{
LobHelper lobHelper = session.getLobHelper
Blob blob = lobHelper.createBlob(f.fileStream, f.length)
myEntity.setBlob(blob)
}
PG's jdbc-driver doesn't implement Connection.createBlob so Hibernate uses a BlobProxy (org.hibernate.engine.jdbc.BlobProxy) which does goes around this.
Are there any examples around using PG with Blobs, using streams (not byte[]) ?
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users