Skip to content

spring-session-jdbc ORA-01461 on save session attributes #1203

Closed
@benwynn

Description

@benwynn

Spring Session JDBC worked with 2.0.5.RELEASE, is now broken with 2.0.6.RELEASE due to code change resulting from issue #1031

We are using Oracle Enterprise Edition 11.2.0.4.v16 on AWS RDS and the new query yields an error:

ORA-01461: can bind a LONG value only for insert into a LONG column

from org.springframework.session.jdbc.JdbcOperationsSessionRepository:

Old Working Query:
private static final String CREATE_SESSION_ATTRIBUTE_QUERY =
"INSERT INTO %TABLE_NAME%_ATTRIBUTES(SESSION_PRIMARY_ID, ATTRIBUTE_NAME, ATTRIBUTE_BYTES) (?, ?, ?)";

New Broken Query:
private static final String CREATE_SESSION_ATTRIBUTE_QUERY =
"INSERT INTO %TABLE_NAME%_ATTRIBUTES(SESSION_PRIMARY_ID, ATTRIBUTE_NAME, ATTRIBUTE_BYTES) " +
"SELECT PRIMARY_ID, ?, ? " +
"FROM %TABLE_NAME% " +
"WHERE SESSION_ID = ?";

My hypothesis is that while binding a blob or clob in to a table works fine, when you bind it to a fictional table created as the result set of "select literal from ..." the type of that BLOB literal gets modified by oracle for backwards compatability to the 'LONG' type which it then cannot use for inserting into the other table. perhaps add a type cast letting the fictional table know what type it is supposed to be?

Thank You

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions