Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] DynamicEntity and arbitrary-length text fields

If I'm using normal JPA-annotated entities and I want to store an
arbitrary-length string, it's straightforward: I annotate the relevant
string getter with @javax.persistence.Lob, and the right thing happens.

If I'm using DynamicEntity, I can't work out how to do the equivalent.

The closest I've come is to build the type like this:

typeBuilder.addDirectMapping("long_text", java.sql.Clob.class, "long_text")

I can then use EntityManager.unwrap to get hold of a java.sql.Connection
on which I can use createClob to create values for the mapping I've added.

Unfortunately, this falls short when my JDBC driver doesn't implement
createClob. Ideally I'd like an equivalent to the @Lob annotation, which
*does* work - presumably by using setCharacterStream on a
PreparedStatement somewhere under the hood.

Any suggestions?

Many thanks,
David


Back to the top