I’d like to use a stream to efficiently stream large BLOBs out of a database with JPA. I’m trying to us JPA reverse engineering feature, but it turns my BLOBs into byte arrays which would have to be brought completely into memory. Is there a way to use the jpa.reveng.xml to use streams instead? I tried to designate the type of the field as InputStream like I saw at OpenJPA, but hibernate doesn’t like that. It fails when it validates the type of the column.
Caused by: org.hibernate.MappingException: Could not determine type for: java.io.InputStream, for columns: [org.hibernate.mapping.Column(contents)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
… 31 more