• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Toplink API

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all together,

i am really weired about the Toplink API and how to use it.
Until now, i used the JPA Implementation from Toplink (with an Entity Manager). My (far far away) Finish is a little Online-Offline WebStart client with DataSync mechanism.
For this Reason i search the web a littlebit and foud some manuals about the "Toplink API", which in my understanding offers a little bit more functionality then the JPA defaults (in fact the "UnitOfWork" seems pretty nice for my application).

Here my "old" EntityManager Project (which connects to the Offline = local Derby-DB), which i want to rebuild with the Toplink API instead.
Entity


My OfflinePU


and a little CodeSnipped:


** works fins **

now i try to build up the connection with the Toplink API instead, but i am too stupid i think ;) Same datasource as above


Error says, that he can't found the datasource and no default driver???

In Toplink Manual i read in addition somethink about the a project.xml, which can be used to read all the configuration aboute the connection from a xml file:


but a) the "XMLProjectReader" seems not be present for toplink-essentials and b) i find nowhere a documentation how to build up such a project.xml

Maybe i am running in the complete wrong direction, hope somebody could show me the right way ;)

thanks a lot
Dom
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your login you need to call, setConnectionString, not setDatabaseURL.

TopLink Essentials does not support the project.xml, but if you upgrade to EclipseLink (TopLink 11g), everything is supported.

In general I would recommend using JPA, not the native TopLink API. You can still use JPA and access the UnitOfWork API when required. You can get a UnitOfWork from an EntityManager, or create one from an EntityManagerFactory's ServerSession.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"da dom", please check your private messages for an important administrative matter.
 
Dominik Müller
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Sutherland wrote: You can get a UnitOfWork from an EntityManager



I found the "getActiveSession()" from EntityManager, this seems to be the best way, but my Problem is that i use the EntityManager (as shown above) from javax.persistence.Persistence; . The additional functions to get the active Session and aquire a unit of work just seems to be present for the entitymanager from Toplink self. The Problem is to get an Toplink-Entitymanager, i need the Factory, the Toplink-EntityManagerFactory need a ServerSession to create, and i am at the same position as above . Or is there any opportunity to get the Session/UoW from the javax.persistence.Persistence.EntityManager; or "convert" this EntityManager in a Toplink-One?

Thanks a lot
Dominik
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can just cast the EntityManager interface to the EclipseLink/TopLink JpaEntityManager. If using JEE, you will need to first call getDelegate().
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic