Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EJB CMP 2.1 - update question

Status
Not open for further replies.

forrozeiro

Programmer
Sep 1, 2001
38
BR
Hi there,

I have a table with, say, these columns

table mytable
col1 (PK)
col2
col3
col4

I am using a container managed persistence bean do map the table. Versions:

EJB 2.1
JBoss 3.2.7

The question is, which is the best way to do an update like this:

update my table set....
where col3 = xxx

That is, update by a column that is not the pk?

Thank you in advance!
 
Assume you store the record in entity bean.
I would get a collection of entities throguh EJB QL like this (select object(c) from table where col3=?).
After you got the collection of entities, you can read the record one by one and update the values of col3.

Please tell us if you use entity bean to store record and do you use EJB QL?

It is better not to write very complicated EJB QL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top