• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBQL

 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

EJBQL can be used for Select only and can't be used for insert, update and delete. If so, how does a CMP bean does insert, update and delete. Is it by means of ejbCreate(insert), ejbStore(update) and ejbRemove(delete) ?
Please clarify my doubt.

Thanks

-- Ravindra Janapareddy
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJBQL means "Enterprise Java Beans Query Language". A query language only allows one to query thing and not to insert, update and delete stuff. Actually, EJBQL is a just syntactic sugar for you to implement finders and select methods. Insert, updates and deletes happen under the hood and are the responsibility of the EJB container which know exactly how to perform those operations when you invoke ejbCreate(), ejbRemove(), etc...
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Valentin

I am trying to remember my past experience when developing beans in EJB 1.0 days that I could have update, insert and delete SQL in a Bean-managed entity bean. I am not developing in EJB anymore. As per EJB 2.0 a BMP bean is obsolete and there is only CMP bean so I got this doubt in my mind as how to do a update, insert and delete so that answers my question.

Thanks and regards

-- Ravindra Janapareddy
 
krishnakumar ramamurthy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A query language only allows one to query thing and not to insert, update and delete stuff.[/B]


SQL is also a Query Language!!!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I certainly won't delve into the details of the semantics of the word "query". Who said "Structured Query Language" aka SQL was a well chosen word sequence for describing what SQL really does ? Anyway, for what interests us, EJB-QL does not allow one to execute inserts, deletes or updates since this is the job of the container... Sorry for the ambiguity
 
Najam Nazar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok its clear...Suppose i want to delete a row from database. i m using session and entity bean. i want to call a finder method in a entity for deleting the line through session...is there any solution for it...


The only solution that i got is that i can only directly interact the jsp or servlet eith the database....

if it has any solution in J2EE then plzz tell

bye
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic