| Creating BLOBs [message #917807] |
Thu, 20 September 2012 08:58  |
Johannes Becker Messages: 3 Registered: September 2012 |
Junior Member |
|
|
Hi,
I'm trying to switch from Hibernate to EclipseLink. Now I'm facing the problem of creating BLOBs. With Hibernate I solved it this way:
import org.hibernate.LobHelper;
import org.hibernate.classic.Session;
...
public Blob createBlob(InputStream inputStream, long length)
{
Session session = entityManager.unwrap(Session.class);
LobHelper lobHelper = session.getLobHelper();
Blob blob = lobHelper.createBlob(inputStream, length);
return blob;
}
Any hints how I can do this with EclipseLink? (I'm on an Oracle DB if this matters).
Jonny
|
|
|
|
|
| Re: Creating BLOBs [message #923063 is a reply to message #923049] |
Tue, 25 September 2012 11:14   |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
Search for "JDBC BLOB examples", you basically just create a select Statement execute it to get the Blob and write into it.
Unless the file is extremely large, it would probably fit into memory as a byte[].
James : Wiki : Book : Blog
|
|
|
| Re: Creating BLOBs [message #923082 is a reply to message #923063] |
Tue, 25 September 2012 11:33  |
Johannes Becker Messages: 3 Registered: September 2012 |
Junior Member |
|
|
Hi,
> Search for "JDBC BLOB examples", you basically just create a select Statement execute it to get the Blob and write into it.
Ok, I'll do that. Thanks. My hope was, that maybe EclipseLink provided such helper-classes as Hibernate.
Thanks
Jonny
|
|
|
Powered by
FUDForum. Page generated in 0.04947 seconds