Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ORA-1461 trying to insert String to XMLType

Hmm. I'm still getting the error.

This is table:

create table my_table (
 record_id      char(36) primary key,
 user_id	char(36),
 record_date	timestamp,
 record_content XMLType
)
XMLTYPE record_content STORE AS CLOB

-----------------------------------------------------------------------------------------------------------------
This is the field in my jpa object:

    @Column(name="record_content", columnDefinition="XMLTYPE")
    private String recordContent;
-----------------------------------------------------------------------------------------------------------------

This is my persistence.xml property
<property name="eclipselink.descriptor.customizer" value="core.traction.db.jpa.XmlDataCustomizer"/>

-----------------------------------------------------------------------------------------------------------------

And this is the code I copied from customfeatures:

package core.traction.db.jpa;

import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.sessions.factories.DescriptorCustomizer;
import org.eclipse.persistence.mappings.xdb.DirectToXMLTypeMapping;

public class XmlDataCustomizer implements DescriptorCustomizer {

public void customize(final ClassDescriptor descriptor) throws Exception{
         descriptor.removeMappingForAttributeName("recordContent");
DirectToXMLTypeMapping mapping1 = new DirectToXMLTypeMapping();
         mapping1.setAttributeName("recordContent");
         mapping1.setFieldName("record_content");
         descriptor.addMapping(mapping1);

     }
}

NOTE: I am still using the thin driver. Does this also have to be changed to OCI, per Prabaharan's post?


On Mar 30, 2009, at 2:01 PM, Yiping Zhao wrote:

Hi David,

In main branch, "customfeatures" jpa test model is under trunk \foundation\eclipselink.extension.oracle.test\resource \customfeatures, the persistence.xml is under trunk\foundation \eclipselink.extension.oracle.test\resource\customfeatures, you can take a look at it.

Yiping

David Parker wrote:
Thanks for the response! I agree that it is a JDBC issue. Your suggestion sounds promising, but I'm afraid I have no idea where to start, not having used the "native" toplink/eclipselink stuff. If you could just point me to the doc for this, I'd appreciate it.

Thanks!

- DAP

On Mar 30, 2009, at 1:44 PM, James Sutherland wrote:


Seems to be a JDBC issue, I would assume you will get the same error through
raw JDBC (SQLPlus does not use JDBC).

In EclipseLink there is a special mapping to handle XML Types, trying using
the DirectToXMLTypeMapping.  You can add this mapping using a
DescriptorCustomizer.


David Parker-13 wrote:

I have a JPA object with a String attribute that is bound to a
database column of XMLType (Oracle 10g R2). When I try to persist the
object, I get the error
ORA-01461: can bind a LONG value only for insert into a LONG column I have seen some posts in various places about problems of this kind
with writing to an XMLType. I am just using XMLType for the first
time, so I may be missing some configuration, but I am able to insert
into it OK from SQL*Plus.

Is there specific support in Eclipselink somewhere for XMLType fields,
or has anybody run into this?
=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx



-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/ toplink/
TopLink
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/ORA-1461-trying-to-insert-String-to-XMLType-tp22747045p22788767.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx




_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx






Back to the top