Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How container puts up primary key in deployement descriptor file in CMP?  RSS feed

 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have done a CMP program in which I observed that when I stored 3 fields in database from client, container took one of the fields as primary key. How container knows which field has to be taken as primary key (in CMP)?

Thanks and Regards,
Narendranath.
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naren

I think you are not clear with the attribute of ejb-jar.xml.

if you see that closely in the tags of <entity></entity> where you define all your entity beans and the cmp fields you define the primary key class and also the <primkey-field></primkey-field>

This xml file is read by container during your deployment and hence container knows which is your primary key field for the entity bean and hence the for the table.

Best Regards
Pankaj
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah! what you said is right and I know that. But in WEBLOGIC you need not even create .xml file manually! If we provide the path for the class files of our CMP program and use build deployment descriptors option, container automatically creates the .xml files. When we try to see ejb-jar.xml file, there the primary key is specified by a field name. I wonder this how it does it selects the primary key from the list of fields we specify in bean class through get and set methods.


Thanks and Regards,
Narendranath.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!