File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to create Entity Bean without a Primary Key class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to create Entity Bean without a Primary Key class" Watch "How to create Entity Bean without a Primary Key class" New topic
Author

How to create Entity Bean without a Primary Key class

Mainak Das
Greenhorn

Joined: Mar 25, 2004
Posts: 2
Is it possible to create a CMP Entity Bean for an existing table which does not have a primary key. In other words can we have a CMP Entity Bean which does not have a Primary Key class. If it is possible then what should the ejbCreate method of the Entity Bean Class return.
However, I was able to create and deploy in Weblogic 8.1 a CMP Entity Bean for an existing table which had a primary key. And in this case the return type of ejbCreate method was the Primary Key Class which I had created for this Entity Bean
Mainak Das
dmainak@rediffmail.com
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Mainak
Well, I wonder if you don't have PK for a table what kind of data is it? If you have stored something in RDBMS then it means it is related with something in "some" way...Either its a weak entity, strong entity , foreign key relation, something...even if something is just data there has to be some sort of uniqueness right? because otherwise how would we differentiate them even by looking at "select * from .." sort of query?
Please let us know why you want to have table without PK?
Regards
Maulin
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
I mean if you have a dependent data (via foreign key relation or something) then you would have that data in some other Entity bean as a entity member rather than entity bean on its own...
Regards
Maulin
 
wood burning stoves
 
subject: How to create Entity Bean without a Primary Key class
 
Similar Threads
ejbCreate
problem creating entity bean(CMP)
problem creating entity bean(CMP)
ejbCreate() in Entity bean returns null
entity bean for a table with No Primary key : Please Help,,,, URGENT