• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How do I 'UPDATE' using EJB

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic