• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I 'UPDATE' using EJB

 
Tiago Sudeval
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Someone can help me, how i do a update using EJB, something similar with 'source' below.



using SQL:


or don't possible?

ps.: EJB is EntityBean
[ November 10, 2006: Message edited by: sudeval ]
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to update in EJB QL?

Steps for UPDATING :

1. Get the particular entity bean(in DB it is a row) using its primary key.

2. Using Bean's Component Interface implemented object, change the value using setter methods.

3. Once done, If it is CMP, container will UPDATE the database. If it is BMP, then you need to write a query in ejbLoad to do the updation.

There is no support for updating in EJB QL and even it doesn't make any sense in this context.

HTH,
 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sudeval",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with display names get deleted.
 
Tiago Sudeval
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prabhu venkatachalam:
Why do you want to update in EJB QL?

Steps for UPDATING :

1. Get the particular entity bean(in DB it is a row) using its primary key.

2. Using Bean's Component Interface implemented object, change the value using setter methods.

3. Once done, If it is CMP, container will UPDATE the database. If it is BMP, then you need to write a query in ejbLoad to do the updation.

There is no support for updating in EJB QL and even it doesn't make any sense in this context.

HTH,



ok, but how do i using ejbLoad() ?

do you have one example ?


Why do you want to update in EJB QL?

because i need performace, and in my source is this:

Using this source i don't has perfomace becaouse i get the connection (Transaction) and get the value, after i get other connection to update the value.

i need the something as a "SELECT ... FOR UPDATE" where i using one connection(transaction) get the value e update this value.

do you understands?

thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!