• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Session facade

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to acess entity bean from session bean. I am creating session bean & entity bean in visualage for java 3.5 enterprise edition. the entity bean which i created is working fine in websphere test environment of visual age. here is the method of session bean which accesses the entity bean
public boolean delete(int id) {
try{
Properties p= new Properties();
p.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:901/");
// CB Factory Name
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
Context ctx = new InitialContext(p);;
Object ref=ctx.lookup("com/Nd_test");
com.Nd_testHome home = (com.Nd_testHome)PortableRemoteObject.narrow((org.omg.CORBA.Object) ref,
com.Nd_testHome.class);
com.Nd_test rem= home.findByPrimaryKey(new com.Nd_testKey(id));
rem.remove();

}catch(Exception e){
System.out.println(e);
return false;}
return true;
}
I tried to use the remove() of home interface.. it is ...

Properties p= new Properties();
p.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:901/");
// CB Factory Name
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
Context ctx = new InitialContext(p);
try
{
Object ref=ctx.lookup("com/Nd_test");
com.Nd_testHome home=(com.Nd_testHome)PortableRemoteObject.narrow((org.omg.CORBA.Object)ref,com.Nd_testHome.class);
home.remove(new com.Nd_testKey(12));
}catch(Exception e){}
It also gives error.
Please point out the problem.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!