Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

primay key ???  RSS feed

 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • 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?
 
Siva Jagadeesan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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".
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!