Skip to main content

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

Hi David,

One thing I can think of right now, it's that you need to have xdb.jar in your classpath, you should get this jar from the installation of database you are connected to.

Yiping
Reinhard Girstenbrei wrote:
Hi David,
currently there is no annotation to define a DirectToXMLTypeMapping. You can use a DescriptorCustomizer to define this mapping using EclipseLink Native API.

public class XmlDataCustomizer implements DescriptorCustomizer {

public void customize(final ClassDescriptor descriptor) throws Exception
  {
         DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping();
         mapping.setAttributeName("xmlDocument");
  }
}

then you have to use the annotation @Customizer on the entity that holds the xml attribute.

Use the Oracle Thin Driver whenever possible. Usually it performs better and you don't need an Oracle Client.
There are only few reasons why an OCI Driver could be required.
If you have to use the OCI Driver, then verify that you are using exactly the same version of the driver's java archive and the Oracle Client (all 5 digits of the version number should be the same).

As you are using Oracle Database server 10gR2 you should use Oracle JDBC Driver 10.2.0.4.0 or 11.1.0.7.0.

Best regards,
Reinhard Girstenbrei


eclipselink-users-request@xxxxxxxxxxx wrote:
Send eclipselink-users mailing list submissions to
    eclipselink-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
    https://dev.eclipse.org/mailman/listinfo/eclipselink-users
or, via email, send a message with subject or body 'help' to
    eclipselink-users-request@xxxxxxxxxxx

You can reach the person managing the list at
    eclipselink-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of eclipselink-users digest..."


Today's Topics:

1. Re: Re: ORA-1461 trying to insert String to XMLType (David Parker)
   2. New QueryException in version 1.1 (khaskett)
3. Re: Re: ORA-1461 trying to insert String to XMLType (David Parker)


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

Message: 1
Date: Mon, 30 Mar 2009 16:38:47 -0400
From: David Parker <dap@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [eclipselink-users] Re: ORA-1461 trying to insert String
    to    XMLType
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID:
    <99A17273-32FB-47CC-A3D9-189861626CFF@xxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

The client is running on MAC OS X, and the server is running on CentOS. I'm not sure how I see that this is going to work?

On Mar 30, 2009, at 2:02 PM, Prabaharan Vijayaratnam wrote:

You don't need to have be on same machine as DB neither you need Oracle Client installed on your client machine:

For your app, set following in the client machine, for example:
setenv ORA102_CLIENT_HOME /path to DB_host/path to DB_install/oracle/ product/10.2.0/db_1
setenv LD_LIBRARY_PATH $ORA102_CLIENT_HOME/lib
db.oci.url=jdbc:oracle:oci:@orcl
db.driver=oracle.jdbc.OracleDriver
have "xdb.jar" in classpath


David Parker wrote:
As far as I know, OCI is not an option, since our client is not on the same machine as the database, and there is no Oracle installation on the client other than the jdbc jar files. OCI requires the C libraries, doesn't it?

But that's good to know that it simply isn't supported in the thin driver. Does creating a temporary CLOB sound to you like a reasonable workaround? I got this approach from the following thread: http://forums.oracle.com/forums/thread.jspa?threadID=693650.

On Mar 30, 2009, at 1:36 PM, Prabaharan Vijayaratnam wrote:

Please make sure you're using Oracle JDBC driver in OCI mode, not THIN. XMLType support available thru Oracle XDB which is available in OCI connection.

regards,
Praba Vijayaratnam

David Parker wrote:
I have not heard anything back on this, nor have I been able to get any answers on the oracle technet forum, though I've seen some posts in the past year with other people having the same problem (on the oracle forum, which were never answered). I suspect this is an Oracle bug, but I don't have access to metalink to download patches, if such exist.

So I'm looking for another way. It seems that one poster was able to get his xml into an XMLType by creating a temporary CLOB in code - writing directly to the JDBC api. Is there a way to do something comparable with eclipselink?

I need this insert to happen in the same transaction as other operations, so it needs access to the connection being used by a given EntityManager. Is it possible to do this through a createNativeQuery, or do I need to get the Connection object?

Thanks.

- DAP

On Mar 27, 2009, at 2:01 PM, David Parker 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




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




_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
<oracle_sig_logo.gif>
Praba Vijayaratnam | Principal Member Technical Staff | Phone: +6137834594
Oracle Server Technologies

ORACLE Canada | O'Connor Street | K1P1A4 Ottawa
<green-for-email-sig_0.gif> Oracle is committed to developing practices and products that help protect the environment _______________________________________________
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

--
<oracle_sig_logo.gif>
Praba Vijayaratnam | Principal Member Technical Staff | Phone: +6137834594
Oracle Server Technologies

ORACLE Canada | O'Connor Street | K1P1A4 Ottawa
<green-for-email-sig_0.gif> Oracle is committed to developing practices and products that help protect the environment _______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/eclipselink-users/attachments/20090330/f94ee84a/attachment.html

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

Message: 2
Date: Mon, 30 Mar 2009 13:47:36 -0700 (PDT)
From: khaskett <khaskett@xxxxxxxxxxx>
Subject: [eclipselink-users] New QueryException in version 1.1
To: eclipselink-users@xxxxxxxxxxx
Message-ID: <22792539.post@xxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii


Is there a way to figure out why I am getting a QueryException in a delete
request?
[3/30/09 14:47:35:328 CDT] 0000003f SystemOut O [EL Warning]: 2009-03-30
14:47:35.328--UnitOfWork(2104393070)--Thread(Thread[WebContainer :
5,5,main])--Exception [EclipseLink-6094] (Eclipse Persistence Services -
1.1.0.r3634): org.eclipse.persistence.exceptions.QueryException
Exception Description: The parameter name [POLICY_NUMBER] in the query's
selection criteria does not match any parameter name defined in the query.
Query: DeleteObjectQuery(com.gmrc.jpa.domain.CpTransaction@de21fdeb)

I was not seeing this in the 1.0.2 version.

I have narrowed it down to the relationship between these two entities.

@Entity
@Table(name = "CP_TRANSACTION")
public class CpTransaction extends BaseDomain implements
java.io.Serializable {
....
    private Set<CpMsg> cpMsgs = new HashSet<CpMsg>(0);
....
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "cpTransaction")
@JoinColumn(name = "POLICY_NUMBER", referencedColumnName = "POLICY_NBR")
    @PrivateOwned
    public Set<CpMsg> getCpMsgs() {
        return this.cpMsgs;
    }

    @Column(name = "POLICY_NUMBER", length = 20)
    public String getPolicyNumber() {
        return this.policyNumber;
    }
}

@Entity
@Table(name = "CP_MSG")
public class CpMsg extends BaseDomain {
    private Long msgId;
.....
    private String policyNbr;
    private CpTransaction cpTransaction;

    @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "POLICY_NBR", referencedColumnName = "POLICY_NUMBER",
updatable = false, insertable = false)
    public CpTransaction getCpTransaction() {
        return this.cpTransaction;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "MSG_ID", unique = true, nullable = false, precision =
11, scale = 0)
    public Long getMsgId() {
        return this.msgId;
    }
        @Column(name = "POLICY_NBR", length = 20)
    public String getPolicyNbr() {
        return this.policyNbr;
    }
}

The SQL relationship is CP_TRANSACTION.POLICY_NUMBER = CP_MSG.POLICY_NBR.

If I do a getCpMsgs() it seems to find them correctly.

Thanks
Kevin




Back to the top