• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

what's the relationship between toplink and ejb?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what situation does toplink have to be used? in essentional, what's the relationship between toplink and ejb?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Toplink is an object to relational mapping tool. When used in an EJB context, a Toplink container replaces the EJB container (at least in Weblogic).
If you are using Toplink, then instead of coding your own JDBC, you would ue their mapping workbnch to map objects and elements to relational database tables and fields. Or you can use Toplink,s API to perform simple to complex queries, inserts, updates, etc. The part I like the most about Toplink is it's flexibility compared to using EJB-QL. You can use aggregate functions such as Sum, Min, Max. It has a mechanism for unique sequence number generation either by using your database's ability to do this, or generically by creating a sequence table. You can drill down to using direct JDBC or SQL statements and stored procedures if you need to.
The two drawbacks with Toplink is that it is a very flexible and powerful tool which can be misused in design, which can result in performance problems with your application. You almost need a specialist, group, or role that is mainly for managing, deploying, and tuning it. Particularly someone who has a good DBA understanding and good knowledge of OOD. The other "drawback" is that it does add about 15% overhead if used without any specialized tuning. This is more of a potential drawback if you consider that if you don't use Toplink, a lot of the things it handles (object/relational mapping, caching, transactional integrity when using BMP Entity beans) will probably have to be done in your code and design.
The biggest advantage to using toplink comes when your data model and/or design changes. Unless you have used more native techniques (like prepared SQL and stored procedures), you do not have to change any code. Just bring up the Mapping workbench, remap the objects to the data, and redeploy. Toplink's mapping uses XML that gets packages with the EJBs. The JDBC (or SQL) is generated based on the mappings dynamically at runtime. Toplink can be configured to log the SQL in the application server log for testing and debug.
Another good advantage it has is when you have objects within objects that have to be loaded. Toplink can be configured to retreive the objects that are referenced in another object all in one transaction, or as needed (using a lazy instantiation pattern). This also works with inherited objects. Of course, here is where you want to be careful with your design as far as performance.
I've not used any other object to relational mapping tools, but we had evaluated Toplink when doing an extensve evaluation of Application servers, and decided that it was a tool worth adding to our development/production setup.
Oh another note. The licensing for toplink is only based on development. The production part of toplink can be distributed to as many production servers as you want at no cost. I know that the Wegain product comes with toplink for it's professional version. Sold alone there was a minimum of 3 developer licence requirement when we were looking at it. If you are considering using WebGain, then it's cheaper to buy Webgain professional, unless you can work out a deal with toplink.
Hope that helps
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
toplink is OR mapping tool.
it maps the relational database tables with the toplink classes and handles the transaction , relatation-ship management issues.
you can use either toplink (OR mapping tool) or EJB's.
TOplink is more suitable for more complex relational databse table handling.

------------------
 
Every plan is a little cooler if you have a blimp. And a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic