Yes, I want something like new InputStream(new MyDBWrapper()) where MyDBWrapper would perform the data fetching and formating. I am not sure I can use ByteInputStream as the data is quite big - can get more then 1 GB.
–
digyOct 10 '10 at 14:29

depends on the type of underlying database connection/driver, if you have access to the JDBC layer (e.g. using Hibernate) it should be possible to stream data using the JDBC Streaming API, then take the Streams from the ResultSet and pass them into Jersey's Response Builder.
I have not done this myself though..