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

Error: [ ejbFindByPrimaryKey ]

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i made the BMP bean. after compliation in deloy time when i when i say
tools -> verifier in j2ee 1.3.1 it will give me following faliure

1.

For [ EmpEntityBean ]
For EJB Class [ EmpEntityBean ] Finder method [ ejbFindByPrimaryKey ]
Error: A [ ejbFindByPrimaryKey ] method was found, but [ ejbFindByPrimaryKey ] return type must be the enterprise beans primary key type.

2.

For [ EmpEntityBean ]
Error: Transaction attributes must be specified for the methods defined in the home interface [ EmpEntityHome ]. Method [ create ] has no transaction attribute defined within this bean [ EmpEntityBean ].

3.

For [ EmpEntityBean ]
For Home interface [ EmpEntityHome ]
Error: No single arg findByPrimaryKey(PrimaryKeyClass) method was found in home interface class [ EmpEntityHome ].


follwowing are my home interface and component interface

public interface EmpEntityHome extends EJBHome
{
public EmpEntity create(int employeeid,String first,String last) throws CreateException,RemoteException;

public EmpEntity findByPrimaryKey(EntityPK key) throws FinderException,RemoteException;

public Collection findByFirstName(String firstname) throws FinderException,RemoteException;
public Collection findByLastName(String lastname) throws FinderException,RemoteException;

public Collection findByEmpEmployeeId(int id) throws FinderException,RemoteException;

}

public interface EmpEntity extends EJBObject
{
public String getEmpFirstName() throws RemoteException;
public void setEmpFirstName(String FirstName) throws RemoteException;

public String getEmpLastName() throws RemoteException;
public void setEmpLastName(String LastName) throws RemoteException;

public int getEmpEmployeeId() throws RemoteException;
public void setEmpEmployeeId(int EmpId) throws RemoteException;

}

this is my bean find by primary key method

public EntityPK ejbFindByPrimaryKey(EntityPK pk) throws FinderException
{
PreparedStatement pstmt = null;
Connection conn = null;
Vector v = new Vector();

try
{
DSManager.getConnection();
System.out.println("ejbFindByPrimaryKey(" + pk + ") called");

pstmt = conn.prepareStatement("SELECT EMPID FROM EMPLOYEE WHERE EMPID = ?");
int id=Integer.parseInt(pk.toString());
pstmt.setInt(1,id);
ResultSet rs = pstmt.executeQuery();
rs.next();
return pk;
}
catch (Exception e)
{
throw new FinderException(e.toString());
}
finally
{
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) {}
try { if (conn != null) conn.close(); }
catch (Exception e) {}
}
}


plz help me out how i solve this problem

regards

amit grover
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you creating BMP Entity Bean?
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not completely sure about these solutions.. hope they help. If you still face the same problem, pase the entire bean code here.


1.

For [ EmpEntityBean ]
For EJB Class [ EmpEntityBean ] Finder method [ ejbFindByPrimaryKey ]
Error: A [ ejbFindByPrimaryKey ] method was found, but [ ejbFindByPrimaryKey ] return type must be the enterprise beans primary key type.


The primary key class must be public, and must have a public constructor without parameters. All fields in the primary key class must be declared public. The names of the fields in the primary key must be a subset of the names of the container-managed fields.


2.

For [ EmpEntityBean ]
Error: Transaction attributes must be specified for the methods defined in the home interface [ EmpEntityHome ]. Method [ create ] has no transaction attribute defined within this bean [ EmpEntityBean ].


You have not specified a transaction attribute for the create() method of the entity bean. As per EJB rules, in case of an entity bean, you will have to specify transaction attributes for:
A. All methods of the component interface
B. remove() method from the EJBObject (or EJBLocalObject)
C. All of the home interface methods written by the Bean Provider, as well as the remove() metods from EJBHome (or EJBLocalHome).

The transaction attribute will be specified for the method in DD.


3.

For [ EmpEntityBean ]
For Home interface [ EmpEntityHome ]
Error: No single arg findByPrimaryKey(PrimaryKeyClass) method was found in home interface class [ EmpEntityHome ].


Please check what you have specified for the PrimaryKeyClass in the descriptor, and see if the same has been specified as the lone argument for your findByPrimaryKey method in the bean.
 
AmitCdac Grover
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks .... now problem is solved .there is something problem with my coding

regards

amit grover
 
reply
    Bookmark Topic Watch Topic
  • New Topic