jmkgreen
jmkgreen

Reputation: 1643

HSQL & Hibernate: unsupported internal operation: Session

I have a project with the following dependencies:

hibernate-entitymanager-4.1.8
hsql-2.2.8

I have a Persistence Unit including:

<properties>
    <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
    <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
    <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
</properties>

And an Entity with a field thus:

@Lob
@Column(name = "DOCUMENT")
private String document;

When I come to persist through the EntityManager my entity I'm seeing the following end of stack trace:

Caused by: java.lang.RuntimeException: unsupported internal operation: Session
at org.hsqldb.error.Error.runtimeError(Unknown Source)
at org.hsqldb.Session.performLOBOperation(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
at org.hsqldb.types.ClobDataID.nonSpaceLength(Unknown Source)
at org.hsqldb.types.CharacterType.castOrConvertToType(Unknown Source)
at org.hsqldb.types.CharacterType.convertToType(Unknown Source)
at org.hsqldb.StatementDML.getInsertData(Unknown Source)
at org.hsqldb.StatementInsert.getResult(Unknown Source)

Am do doing something obviously wrong here? This was working albeit with quite a few changes and on a different machine. Possibly a result of a dependency upgrade or a switch to JPA/Hiberate from a straight Spring/Hibernate abstraction layer.

Several others reporting much the same thing found via Google but no particular solution :(

Upvotes: 1

Views: 2444

Answers (3)

Mao
Mao

Reputation: 77

I even tried with newer version HSQLDB 2.4.1 and Hibernate-core 5.3.6, the problem still persists. Because Hibernate generates schema with only 255 char column length, in my case, try to alter column type works (clob instead of clob(255))

alter table public.user alter column myClobColumn clob

Upvotes: 0

fredt
fredt

Reputation: 24352

This issue has been fixed in the latest version of HSQLDB. Version 2.3.0 is available from hsqldb.org.

Upvotes: 2

user2342416
user2342416

Reputation: 21

A fix in Hibernate 4.1.8 created a regression. For HSQLDB, Schema export will create a blog/clob limited to 255 char.

When using HSQLDB, inserting any CLOB value larger than 16Mb always fails with an exception

Pull request

Upvotes: 2

Related Questions