You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Marcus Geiger <bw...@prometheus.homeunix.org> on 2003/08/04 16:56:13 UTC
Postgresql Clobs, SQLException: Unknown Types value
Hi there,
I'am fairly new to OJB and try to get my feet on it.
My problem is, that I can't get Clobs working. The software I use:
- OJB-1.0.rc4
- postgresql-7.3.3_1
- FreeBSD 5.1-RELEASE
- JDK-1.4.1 (native).
I get the following error when trying to insert Clob data:
org.postgresql.jdbc1.AbstractJdbc1Statement.setObject(AbstractJdbc1Statement.java:1392)
org.postgresql.jdbc1.AbstractJdbc1Statement.setObject(AbstractJdbc1Statement.java:1398)
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(Unknown
Source)
org.apache.ojb.broker.platforms.PlatformPostgreSQLImpl.setObjectForStatement(Unknown
Source)
org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(Unknown
Source)
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown
Source)
...
Caused by: Unknown Types value.
...
I checked against the junit tests BlobTest, but I can't find any
difference to my setup.
Here is my torque-schema.xml
...
<table name="template" description="templates of weblogusers">
<column name="tmpl_id" required="true" primaryKey="true"
type="INTEGER"/>
<column name="user_id" required="true" type="INTEGER"/>
<column name="name" type="VARCHAR" size="32"/>
<column name="body" type="LONGVARCHAR"/>
<foreign-key foreignTable="webloguser">
<reference local="user_id" foreign="user_id"/>
</foreign-key>
</table>
...
I verified that the column body results in a bytea type.
My repository-user-xml:
...
<class-descriptor class="org.antbear.elise.persistence.Template"
table="template">
<field-descriptor
name="templateId"
column="tmpl_id"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"/>
<field-descriptor
name="userId"
column="user_id"
jdbc-type="INTEGER"/>
<field-descriptor
name="name"
column="name"
jdbc-type="VARCHAR"/>
<field-descriptor
name="body"
column="body"
jdbc-type="CLOB"/>
</class-descriptor>
...
Parts of the VO:
public class Template {
private int templateId;
private int userId;
private String name;
private char[] body;
...
And finally the code that causes the exception:
WeblogUser user = new WeblogUser();
user.setUsername("foo");
...
char[] body1 = new char[50];
for (int n = 0; n < body1.length; n++)
body1[n] = 'x';
Template tmp1 = new Template();
tmp1.setName("default template");
tmp1.setBody(body1);
Collection col = new ArrayList();
col.add(templ);
user.setAllTemplatesOfUser(col);
broker.beginTransaction();
broker.store(user);
broker.commitTransaction();
Is there anything I overlooked?
Marcus
--
We'll try to make different mistakes this time.
(Larry Wall)
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org