Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be cast to oracle.sql.BLOB #2

Open
seanleblanc opened this issue Jan 14, 2014 · 2 comments
Open

Cannot be cast to oracle.sql.BLOB #2

seanleblanc opened this issue Jan 14, 2014 · 2 comments

Comments

@seanleblanc
Copy link

I get this error upon trying to save when using Oracle as DB:

java.lang.ClassCastException: grails.plugin.lazylob.LazyBlob cannot be cast to oracle.sql.BLOB
at oracle.jdbc.driver.OraclePreparedStatement.setBlob(OraclePreparedStatement.java:6481)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setBlob(OraclePreparedStatementWrapper.java:126)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setBlob(DelegatingPreparedStatement.java:184)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setBlob(DelegatingPreparedStatement.java:184)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setBlob(DelegatingPreparedStatement.java:184)
at grails.plugin.lazylob.LazyBlobType.nullSafeSet(LazyBlobType.java:25)

I'm using Grails 2.0.1.

@sebDK
Copy link

sebDK commented May 12, 2014

I get exactly the same problem with grails-2.3.1.
Any workaround?

Thanks for your help.

@sebDK
Copy link

sebDK commented May 15, 2014

Hi,

This is the workaround I used.
In LazyBlobType I changed

public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
BlobType.INSTANCE.nullSafeSet(st, value, index, getCurrentSession());
}

to

public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
BlobType.INSTANCE.nullSafeSet(st, ((LazyBlob)value).getBlob(), index, getCurrentSession());
}

and added the following into LazyBlob.java

public Blob getBlob() throws SQLException {
initialize();
return realLob;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants