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

PostgreSQL : CLOB being a TEXT not really being a CLOB #338

Closed
nlmarco opened this issue Apr 19, 2020 · 2 comments
Closed

PostgreSQL : CLOB being a TEXT not really being a CLOB #338

nlmarco opened this issue Apr 19, 2020 · 2 comments
Labels
Milestone

Comments

@nlmarco
Copy link

nlmarco commented Apr 19, 2020

I just encountered this error:

	Caused by: org.datanucleus.exceptions.NucleusDataStoreException: Cannot get Object result for param = 8 for column "repository.remoteroot" : Unzulässiger Wert für den Typ long : https://subshare.codewizards.co:3339/1a717d9e-896e-4bc1-ab8f-e1da839599af.
		at org.datanucleus.store.rdbms.mapping.column.ClobColumnMapping.getObject(ClobColumnMapping.java:147)
		at org.datanucleus.store.rdbms.mapping.column.ClobColumnMapping.getString(ClobColumnMapping.java:107)
		at org.datanucleus.store.rdbms.mapping.java.TypeConverterMapping.getMemberValueFromDatastore(TypeConverterMapping.java:249)
		at org.datanucleus.store.rdbms.mapping.java.TypeConverterMapping.getObject(TypeConverterMapping.java:536)
		at org.datanucleus.store.rdbms.fieldmanager.ResultSetGetter.fetchObjectField(ResultSetGetter.java:181)
		at org.datanucleus.state.StateManagerImpl.replacingObjectField(StateManagerImpl.java:1995)
		at co.codewizards.cloudstore.local.persistence.RemoteRepository.dnReplaceField(RemoteRepository.java)
		at org.subshare.local.persistence.SsRemoteRepository.dnReplaceField(SsRemoteRepository.java)
		at co.codewizards.cloudstore.local.persistence.Entity.dnReplaceFields(Entity.java)
		at org.datanucleus.state.StateManagerImpl.replaceNonLoadedFields(StateManagerImpl.java:4373)
		at org.datanucleus.store.rdbms.query.PersistentClassROF$1.fetchNonLoadedFields(PersistentClassROF.java:508)
		at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3215)
		at org.datanucleus.store.rdbms.query.PersistentClassROF.findObjectWithIdAndLoadFields(PersistentClassROF.java:477)
		at org.datanucleus.store.rdbms.query.PersistentClassROF.getObject(PersistentClassROF.java:383)
		at org.datanucleus.store.rdbms.query.ForwardQueryResult.nextResultSetElement(ForwardQueryResult.java:181)
		at org.datanucleus.store.rdbms.query.ForwardQueryResult$QueryResultIterator.next(ForwardQueryResult.java:409)
		at org.datanucleus.store.rdbms.query.ForwardQueryResult.processNumberOfResults(ForwardQueryResult.java:137)
		at org.datanucleus.store.rdbms.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:165)
		at org.datanucleus.store.rdbms.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:291)
		... 25 common frames omitted
	Caused by: org.postgresql.util.PSQLException: Unzulässiger Wert für den Typ long : https://subshare.codewizards.co:3339/1a717d9e-896e-4bc1-ab8f-e1da839599af.
		at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:2878)
		at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2085)
		at org.postgresql.jdbc.PgResultSet.getClob(PgResultSet.java:453)
		at org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:655)
		at org.datanucleus.store.rdbms.datasource.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:655)
		at org.datanucleus.store.rdbms.mapping.column.ClobColumnMapping.getObject(ClobColumnMapping.java:121)
		... 43 common frames omitted

with a field annotated like this:

	@Column(jdbcType="CLOB")
	private URL remoteRoot;

I assume that the problem is the same as #234 but this time dealing with CLOBs instead of BLOBs.

I did not yet write a new test-case, because (1) I'm currently too busy with other things and (2) I'm not sure whether this is actually needed given the fact that this is likely the same as the other problem #234.

Do you need a test-case for this?

In order to get a short-term-solution, I'll first try

	@Column(jdbcType="LONGVARCHAR")
	private URL remoteRoot;

...let's see, if this works fine with both Derby and PostgreSQL.

Also, I already opened pgjdbc/pgjdbc#1760 in the PostgreSQL-JDBC-driver.

@andyjefferson
Copy link
Member

Since PostgreSQL JDBC doesn't "support" CLOB (or BLOB) then the problem is really your demands on the driver. Just because DN tries to hack around this lack of support. Find a better "hack" than what it does now ?

The "solution" is you don't put DB specific info into annotations like we have always said, use the respective "orm" file. Yeah, it doesn't allow refactoring but that's a satisfactory "solution" either way

@andyjefferson andyjefferson changed the title CLOB being a TEXT not really being a CLOB PostgreSQL : CLOB being a TEXT not really being a CLOB Apr 19, 2020
@nlmarco
Copy link
Author

nlmarco commented Apr 19, 2020

I added ORM-files and try to fix both #234 and this issue with PostgreSQL-specific JDBC-types. Tests are still running.

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

No branches or pull requests

2 participants