Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CMP  RSS feed

 
Ramya Dhurga
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to delete and update a record using cmp? Please send me one sample program.
 
Peter Rooke
Ranch Hand
Posts: 857
1
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You delete entity beans via their home or component interfaces. The method you use is called [unsurprisingly] remove. Its signature is remove() in the home, and is overloaded in the component so it is remove(Handle handle) and also remove(Object key).

Updates are done by setting the CMP / CMR fields to their new values, the container is tasked with keeping this information synchronized.

The container will then reflect these changes in the database, and should delete or modify the row(s).

For examples, have a look at Ed Roman's Book, Mastering Enterprise JavaBeans.

Mastering Enterprise JavaBeans
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example code:


As you can see working with the entity beans is just like working with live data. Any changes you make to the entity object are also updated in the database. Hope this helps.
 
Ramya Dhurga
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for both of u i got the output.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!