Oracle Toplink:-
Oracle TopLink supports access to any data store accessible through standard JDBC using standard SQL.
Additionally TopLink offers database platforms that allow for specific functionality to be exposed such as
native SQL, sequencing, out-join syntax, custom date/timestamp operators and formats, and schema import
and generation with the mapping editors.

To setup Oracle Toplink please follow the below steps :-

1.We need to identify the version of the Oracle Toplink used in the application.

2.Ensure the below jar files are downloaded.

  o eclipselink.jar
  o javax.persistence_2.0.0.jar (this version would be on the base Toplink version)
  o toplink-grid.jar
  The above jar files can be found in this link

3. Download Coherence from OTN and define user library 'Coherence' containing in this link
   o coherence.jar
4. The application server lib folder must have the DB2JCC jar  file.
5. The below parameters needs to be modified in  persistence.xml file for working on DB2.This file is present in the source code folder of the application(usually META-INF).
   <property name="eclipselink.jdbc.driver" value="" />
               <property name="eclipselink.jdbc.url" value="jdbc:db2://<portnumber>/<db2dbname>" />
               <property name="eclipselink.jdbc.user" value="<userid>" />
            <property name="eclipselink.jdbc.password" value="<password>" />
6. In some cases Named queries might be used.These are written in standard sql. Mostly these queries work in DB2.
   But still in case of any issues you may ensure the queries work fine in DB2.
    For eg:- You may find an xml file called eclipselink-orm.xml (this xml file is present in the same folder as persistent.xml) where queries will be defined in the below way:-
   1. Firstly Inside the JAVA code you will find the Toplink mapping as
    List<Employee> employees = em
                .createNamedQuery("Employee.findByLastNameLike", Employee.class)
                .setParameter("lastName", "Smit%")
   2. Here Employee.findByLastNameLike is the name by which you will find in the xml file under the named-query tag.            
    <entity class="gridcache.xml.model.Employee">
            <customizer class="oracle.eclipselink.coherence.integrated.config.GridCacheCustomizer"/>
            <table name="TLG_XML_GC__EMPLOYEE">
            <named-query name="Employee.findByLastNameLike">
                <query>SELECT e FROM Employee e WHERE e.lastName LIKE :lastName</query>
                <id name="id">
                    <generated-value />
                <version name="version">
                <one-to-many name="phoneNumbers" mapped-by="owner">
                        <cascade-all />
                <one-to-one name="address" fetch="LAZY">
                        <cascade-all />

These posts are my opinions and do not necessarily represent IBM’s positions, strategies, or opinions  
Happy Reading!!

Ramya Yeleswarapu mailto :- ramyeles@in[dot]ibm[dot]com

Views: 143


You need to be a member of ChannelDB2 to add comments!

Join ChannelDB2

Featured Downloads

Try BLU Acceleration on Cloud

© 2018   Created by channeldb2.   Powered by

Badges  |  Report an Issue  |  Terms of Service