What is the alternate for deprecated Hibernate.createClob(Reader reader, int length)

Ashraf picture Ashraf · Feb 16, 2012 · Viewed 12.3k times · Source

Seems like Hibernate.createClob(Reader reader, int length) is deprecated in version 3.6.x And it suggests to use Use LobHelper.createClob(Reader, long) instead.

But LobHelper is an interface not a class.

Is there any alternate for static method Hibernate.createClob(Reader reader, int length)?

Answer

dhernandez picture dhernandez · Jun 6, 2013

I was using the createBlob(bytes[]) from that class. I created a new class and the following method

    public static Blob createBlob(byte[] bytes) {
       return NonContextualLobCreator.INSTANCE.wrap(NonContextualLobCreator.INSTANCE.createBlob(bytes));
    }