1

I need to store a pretty much unlimited String (document) and I won't be able to determine it's length. I know there is CLOB, but I couldn't find it's implementation in JDO, just JPA.

I tried that:

@Column(jdbcType="CLOB")
private String contents = "";

But when I run schema validation tool I receive:

An exception was thrown during the operation of SchemaTool. Please refer to the log for full details. The following may help : Incompatible data type for column SCENE.CONTENTS : was VARCHAR (datastore), but type expected was CLOB (metadata). Please check that the type in the datastore and the type specified in the MetaData are consistent.

I must be missing something basic...

Paul
  • 389
  • 3
  • 11

1 Answers1

2

You couldn't find CLOB in JDO ? JDO allows you to define "jdbc-type", so you have the full range of types. In JPA you have a very limited set

DataNucleus
  • 15,497
  • 3
  • 32
  • 37
  • Yeah, I was trying to set JDBC type to CLOB, but it didn't have any effect, it still said that String is too long (over 256 chars), what's the correct way to define String as a CLOB with JDO annotations? – Paul Mar 12 '12 at 07:25
  • jdbc-type="clob" obviously, as per the JDO spec and docs. But if your table has VARCHAR(256) already defined then it would be pointless. You don't provide that detail – DataNucleus Mar 12 '12 at 07:38
  • Well, I'm not defining it, it's all automatic datanucleus stuff. I have used: @Column(jdbcType="CLOB") String contents = ""; I was deleting and creating schema after my changes. – Paul Mar 12 '12 at 11:10
  • look in the log. it tells you everything ... what mapping chosen, what schema generated, everything. You provide no classes, dont say what DB, don't mention your complete mapping details, so nothing much more than guesswork would be possible – DataNucleus Mar 12 '12 at 11:57
  • I have added log message and my part of code to the question. I thought there was some generic solution - I must be missing something basic and obvious... – Paul Mar 23 '12 at 10:25
  • Why would you add a log message? Just look at the (DEBUG level) log messages that DataNucleus sends to the log. Or even just post the log contents (in your question) around the initialisation of the table for this class. – DataNucleus Mar 23 '12 at 12:01
  • Hmm... I have tried to do that on another computer and I cannot reproduce the problem - everything works completely fine. I will have to check my configuration there. – Paul Mar 23 '12 at 12:38