• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Home methods

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We arent allowed to get a reference to EJBObject or get primary key in Home methods because the bean has no EJBObject (they are inside the pool).

What would happen if we called create() / findByPrimaryKey(..) on the home interface, then try to get a reference to those? Might be a meaningless thing to do, but would it return the references?
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We arent allowed to get a reference to EJBObject or get primary key in Home methods because the bean has no EJBObject (they are inside the pool).

What would happen if we called create() / findByPrimaryKey(..) on the home interface, then try to get a reference to those? Might be a meaningless thing to do, but would it return the references?


Here Home Methods mean Home Business Methods. Home business methods can be used by any ejbs.

create and findByPrimayKey will return EJBObject references.

Hope it helps
 
Dan T
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe my question was not clear.

Things you can do in your Home Business methods:
- getEJBHome
- getEJBLocalHome
- isCallerInRole(..)
- getCallerPrincipal
- setRollBackOnly
- getRollBackOnly
- JNDI env
- access other beans
- Resource manager

Hence we are not allowed to call getEJBObject() and getPrimaryKey() on the EntityContext because there is not an EJBObject associated with the bean (it is in the pool). What if we called the create() or findByPrimaryKey() method before invoking the getEJbObject in the home business? Calling these methods will either create and find an EJbObject, so will it return the references in the home methods?
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's going to throw illegalStateException since there is no EJBObject associtated with the entitycontext.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic