-->
Skip to main content

Invalid column type: getString/getNString not implemented for class oracle.jdbc.driver.T4CBlobAccessor

Invalid column type: getString/getNString not implemented for class oracle.jdbc.driver.T4CBlobAccessor

Exception Trace

Invalid column type: getString not implemented for class oracle.jdbc.driver.T4CBlobAccessor When Retrieving BLOBsjava.sql.SQLException: Invalid column type: getString/getNString not implemented for class oracle.jdbc.driver.T4CBlobAccessor
    at oracle.jdbc.driver.Accessor.unimpl(Accessor.java:296) ~[ojdbc8-12.2.0.1.0.jar:12.2.0.1.0]
    at oracle.jdbc.driver.BlobAccessor.getString(BlobAccessor.java:238) ~[ojdbc8-12.2.0.1.0.jar:12.2.0.1.0]
    at oracle.jdbc.driver.GeneratedStatement.getString(GeneratedStatement.java:287) ~[ojdbc8-12.2.0.1.0.jar:12.2.0.1.0]
    at oracle.jdbc.driver.GeneratedScrollableResultSet.getString(GeneratedScrollableResultSet.java:374) ~[ojdbc8-12.2.0.1.0.jar:12.2.0.1.0]
    at oracle.jdbc.driver.GeneratedResultSet.getString(GeneratedResultSet.java:594) ~[ojdbc8-12.2.0.1.0.jar:12.2.0.1.0]
    at com.zaxxer.hikari.pool.HikariProxyResultSet.getString(HikariProxyResultSet.java) ~[HikariCP-3.4.5.jar:na]
    at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:62) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3087) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1851) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.hydrateEntityState(Loader.java:1779) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1752) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.getRow(Loader.java:1600) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:743) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.processResultSet(Loader.java:1006) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.doQuery(Loader.java:962) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:352) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:322) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    at org.hibernate.loader.Loader.loadEntity(Loader.java:2403) ~[hibernate-core-5.4.17.Final.jar:5.4.17.Final]
    ... 158 common frames omitted

Solution

This error occurs when we try to read the blob datatype column into the String variable.
When reading blob data type byte[] should be used instead of a String variable.

For example : 
 @Column
 String searchQuery; 
is defined as blob type in the database but here in entity definition its String type so it will throw this error,

To resolve this we just need to change the data type of searchQuery variable to byte[].
@Column
byte[] searchQuery;
That's it. it will work fine.

Thanks for reading this tutorial so far. If you like this tutorial then please share it with your friends and colleagues. If you have any questions, doubts, suggestions, or feedback then please drop a comment and I'll try to answer your question.

Happy Learning!!!

Comments