• 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

primay key ???

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should the primary key map to a column in the database?
What if my create method returns a value that is not the primary key of the entity bean?
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure I understand your question. Anyways let me try to explain. A findBy method in a Bean implementation returns the priamry key that is Present in the database and the ejbContainer will load the Entity Bean corresponding to the PrimaryKey and returns the EjbObject. If you try to find Data with the PrimaryKey that is not present in the database, I am not sure whether it will return a Null, or throw FinderException.
 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi shiva kumar,
What i wanted to know is if i return a junk value in my ejb create what is the consequence?
Hope i am clear
 
Siva Jagadeesan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What i wanted to know is if i return a junk value in my ejb create what is the consequence?
Hope i am clear


I am not that clear with your question. What you mean by you returning a junk value in the ejbCreate method ?!?!
Anyways, if you pass a junk PrimaryKey to the findByPrimaryKey method it will throw a sub-class of FinderException called "ObjectNotFoundException".
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic