Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

what is "Key class"  in  Entity Bean of EJB ?

Thread view: 
gk - 10 Aug 2006 19:53 GMT
Hi, I have 4 questions ....i have made it in a interactive way and
tried to explain in simple way.

do you have answer ?

what is "Key class"  in  Entity Bean of EJB ?

you might say, for each primary key/field  of a table, there should be
a class , and its a "Key class"

am i right ?

Q1 :

If so,  there are so many fields in a table apart from the primary
field.

why  we  dont  make  the classes for those ?  we only  make a class
for  Primary  filed ? why ?
is it because when we pull by keywe will get value ?
or any other reason also ?

Q2:
how this primary Key class is used in the Entiyty bean ?

Q3:
can we make 2  Key class  ?  can we use these 2 in the Entity Bean ?

Q4: i have a column say ALPHA  and has the values say  A,B,C etc in 3
rows respectively.

how do i make a Key class for such column type carrying these values ?

Regards
Arne Vajhøj - 11 Aug 2006 02:42 GMT
> what is "Key class"  in  Entity Bean of EJB ?
>
> you might say, for each primary key/field  of a table, there should be
> a class , and its a "Key class"
>
> am i right ?

Yes.

> Q1 :
>
[quoted text clipped - 5 lines]
> is it because when we pull by keywe will get value ?
> or any other reason also ?

The the multi field primary key needs to be treated as one unit.

The other fields do not.

> Q2:
> how this primary Key class is used in the Entiyty bean ?

Among other places in findByPrimaryKey method.

> Q3:
> can we make 2  Key class  ?  can we use these 2 in the Entity Bean ?

No only one.

> Q4: i have a column say ALPHA  and has the values say  A,B,C etc in 3
> rows respectively.
>
> how do i make a Key class for such column type carrying these values ?

You can either use java.lang.String as your key class or
you can make 1 class which contains 1 field.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.