Hi Krzysztof,

It is interesting since OpenJPA source contains a test case for XML mapping [1] 
and it was passing when I last ran it on PostgreSQL. Most likely it is because 
I have got PostgreSQL 8.3 and some 8.* driver. It also passed with some other 
databases. Is it possible that you give it a try with an 8.3 or 8.4 driver, 
assuming it works with PostgreSQL 9?

Anyway, you could open a JIRA issue, so that PostgreSQL support gets up to date.

Regards,
Milosz

[1] 
https://fisheye6.atlassian.com/browse/~br=trunk/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping?r=1004043


> Seems I resolved these two problems by changing java type to PC_UNTYPED and
> type to SQLXML in slightly changed XMLValueHandler from openjpa source tree:
> 
>      public Column[] map(ValueMapping vm, DBIdentifier name, ColumnIO io,
>         boolean adapt) {
>         Column col = new Column();
>         col.setIdentifier(name);
>         col.setJavaType(JavaTypes.PC_UNTYPED); //was JavaTypes.STRING
>         col.setSize(-1);
>        
> col.setTypeIdentifier(DBIdentifier.newColumnDefinition(vm.getMappingRepository().getDBDictionary()
>             .xmlTypeName));
>         col.setXML(true);
>         col.setType(Types.SQLXML);    // new, otherwise CLOB is picked up. 
>         return new Column[]{ col };
>     }
> 
> I'm not sure how generic is this though.
> 
> XML is stored and reconstructed JAXB objects look ok now.
> Krzysztof
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/XMLValueHandler-strategy-not-supported-in-Postgres-tp6331286p6331526.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 

Reply via email to