Hi David,
I have done this already with TopLink 10.1.3.x. I do not remember the
version of
Oracle Database Server I have used.
Please notice that there are many dependencies.
Oracle JDBC Driver, OCI Driver native library, Oracle Client, Oracle
Database Server, Oracle XDB java archive.
Each version of each component is providing different features, which
allows/requires a different usage of XMLType.
If you have a support contract for TopLink, Oracle Application Server
or WebLogic Server, then you have access to the "My Oracle Support"
(formerly called "Metalink") support forum. There you will find an
example based on TopLink Native API. For sure you can open a service
request to get your own problem with EclipseLink fixed.
Here is the relevant docu:
http://wiki.eclipse.org/Configuring_a_Relational_Direct-to-XMLType_Mapping_(ELUG)
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#How_to_Use_the_.40Customizer_Annotation
Best regards,
Reinhard
The scenario you are using is not entirely clear.
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: Re: ORA-1461 trying to insert String to (David Parker)
----------------------------------------------------------------------
Message: 1
Date: Tue, 31 Mar 2009 11:01:20 -0400
From: David Parker <dap@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [eclipselink-users] Re: Re: ORA-1461 trying to insert
String to
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID:
<5EDBE362-856B-4AB4-BC97-F7923C31FEA2@xxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
If I could just summarize the information I've gotten (thanks again,
everybody who has chimed in):
Required to store an XMLType > 4000 chars:
1) OCI driver
2) Customizer class defined, configured in persistence.xml, and
@Customizer annotation on target entity field
3) xdb.jar from server in classpath
4) XMLType column in database defined with CLOB storage clause
I am currently using eclipselink 1.0.2. Is 1.1 required?
Does anybody have this working on a 10g R2 database?
Does this require the 11g driver? (they don't have the 11g oci driver
for OS X yet, apparently)
- DAP
On Mar 31, 2009, at 9:34 AM, Yiping Zhao wrote:
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=""
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
_______________________________________________
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
End of eclipselink-users Digest, Vol 19, Issue 64
*************************************************
--
Reinhard Girstenbrei | Senior Principal Technical Support
Engineer
Phone: +498914302318 | Mobile: +491775941318
Oracle Oracle Customer Service
ORACLE Deutschland GmbH | Riesstr. 25 | 80992 München
ORACLE Deutschland GmbH, Hauptverwaltung: Riesstraße 25,
D-80992 München
Geschäftsführer: Jürgen Kunz, Registergericht: Amtsgericht München, HRB
82775
 |
Oracle is committed to developing practices and
products that help protect the environment |
|