This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

update records with CMP entity bean  RSS feed

 
Arundhathi Menon
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Cld u pls tell me how to update records using the CMP entity bean..
regards,
Menon
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to look for the entity bean using the primary key:
EntityLocalHome entityLocalHome = (EntityLocalHome) context.lookup( JNDI_NAME_FOR_LOCAL_HOME );
EntityLocal entityLocal = entityLocalHome.findByPrimaryKey(entityPK);
//here comes the update of the fields
entityLocal.setXXX(...);
Updating the fields with CMP is as simple as calling the setXXX corresponding methods for the fields you want updated. From now on it's the container job to persist your changes.
Let us know if you need more info.
Cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!