• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problem using findByPrimaryKey with a CMP Bean

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently running the Tutorial for building J2EE Applications using JBOSS and ECLIPSE chapter 6
the tutorial shows you how to create a CMP. One of the methods is findByPrimaryKey.

The problem is that when I call the findByPrimaryKey method :

SupplierLocal supplier = this.suppLocalHome.findByPrimaryKey(suppID);

It returns a null pointer value.

According to the tutorial the findByPrimaryKey is set by the container.

Using a search I can find reference to the findByPrimaryKey in two files:


SupplierHome

public au.com.tusc.cmp.Supplier findByPrimaryKey(java.lang.String pk)
throws javax.ejb.FinderException,java.rmi.RemoteException;


SupplierLocalHome


public au.com.tusc.cmp.SupplierLocal findByPrimaryKey(java.lang.String pk)
throws javax.ejb.FinderException;

But it has not generated any reference to the findByPrimaryKey method in the deployment descriptors.


What I need to know is how to set the findByPrimaryKey method within the deployment descriptors.
Or how to set it up with xdoclet.

Thanks for any help.

Tony
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup ! I have the same problem. I the same code deployed on WebLogic 7.1 and when I print ctx.getPrimaryKey() in ejbPostCreate method, I could get the Primary Key value. However, JBoss is not setting the context properly. However, the row is getting inserted in database with correct sequence value.

BTW, I am using JBoss 4.0 with MySql 5.0. My table has primary key defined as AUTO_INCREMENT column. In my code, I am establishing a CMR relation with another entity bean and JBoss is creating a new Bean of current type (I am guessing it because I could see setEntityContext invoked again) before establishing the relation. I am
[ September 17, 2004: Message edited by: varanasir ]
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic