• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question about EJB-QL

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I looked at some old topics, I found this question which I don't know the answer, anybody have a clue?
"EJB-QL:
You should know that what variables should be part of both PrimaryKey class as well as the cmp bean?"
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me make sure I understood the question correctly: You are asking does one have to know the primary key fields and CMP fields before writing EJB-QL queries?
I don't think one needs to know the fields which compose the primary key. However one shud know the virtual i.e. CMP fields coz the only way for the bean to interact with the database is thru the abstract getters and setters methods. So you are allowed to use only the CMP fields in EJB-QL query.
HFE Pg 401 says: "As a bean provider, you can happily write all the queries you want, trusting that the Deployer will in the end, map your CMP fields to the real tables and data".
Also example in HFE Pg 403 says: "genre" must be CMP field in the Movie Bean, which means you can find a getter/setter method for it in the bean class" (as I told before).
Sudhir
 
calvin zhu
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Sudhir. The problem is I don't really understand the question too.
I found the original topic,
https://coderanch.com/t/157746/java-EJB-SCBCD/certification/important-tips-before-taking-exam
It is one of the tips in "few important tips before taking exam ", that's why I'm so concern about this question.
EJB-QL:
You should know how to write a query
You should know whats illegal in EJB-QL query
You should know about WHERE , FROM , IN ,AS clauses
You should know about Pathexpressions
You should know about collections
You should know that ejbSelect<Methods>are written in bean class not in home interface
You should know that ejbFind<Methods> are written in home interface
You should know the difference between find and select method
You should be aware of PrimaryKey field, class , type
You should be aware of defining custom composite primary key class and the things it need to contain
You should know that what variables should be part of both PrimaryKey class as well as the cmp bean?
You should know about EJB-QL and Abstract Presistance Schema
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that it means that the fields in the primary key class have to be a subset of the cmp fields declared for the bean.
Here are the other rules for the primary key class:
1) it has to be declared public
2) it should have a no arg constructor
3) the fields have to be public
/Regards
Magnus
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic