Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

remove() is not removing the record from the database

 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a code here for Entity bean client



I am trying to call remove at the last line but it is not removing the actual record from the database.
even if I see on the console of weblogic i found that ejbRemove is not called.

I have tried calling remove on the home i.e. remove(new Integer(1)) where 1 is the primary key but then too it is not resulting in database record to be deleted and as well as no ejbRemove is called.

Where as on line 4 of the code i am changing the name and on 5 i am getting the changed name..i got the changed record but only the last line is not working properly as spec says.
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakesh,

In order to remove an entity from the db you should call EntityManager.remove(Entity bean) or if you create a native query and execute it. Your BankComponent.remove() method what does it contain? Does the client and the bean belong to an enterprise application or the client bean is connecting to EJB container remotely?

Regars,
Nicolas
 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note :- I am using BMP of EJB 2.0
But specification says that if I call remove on the component interface for an entity bean it will delete the record from the database.

Even if I call remove() method on the component interface i.e. on the EJBObject,
ejbRemove() does not get called and no database record is deleted.

Do I have to put the delete sql statement in the ejbRemove() but even if I place the delete sql statement in the ejbRemove(), this method is also not getting called when I call the remove method on the component interface.


I have even tried calling remove method on the home inteface that takes primary key object as an argument but it is still not working
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic