Hi,
First of all, I apologize for this late answer;
I was out of my office for several weeks.
Have you resolve your problem ?
It seems there is mixing up with long and java.lang.Long.
If the 'roleID' attribute is defined in the deployment descriptor
as the primkey-field, it must be declared java.lang.Long instead of
java primitive type 'long'.
Hope this help you.
Regards.
H�l�ne.
[EMAIL PROTECTED] wrote:
>
> I have simple EJB with CMP fields
> it does not have ejbCreate() & ejbPostCreate() functions, but has
> ejbCreate(long pk) ejbPostCreate(long pk) functions. Primary key class in
> deployment descriptor is java.lang.Long
> Here is extract from class definition:
>
> public class RoleBean implements EntityBean {
> public long roleID; //this is primary key
> public String roleName;
>
> public void ejbPostCreate(long roleID) throws CreateException {
> }
>
> public java.lang.Long ejbCreate(long roleID) throws CreateException,
> DuplicateKeyException {
> this.roleID = roleID;
> roleName = "";
>
> // In CMP, should return null.
> return null;
> }
> //.....
> }
>
> public interface RoleHome extends EJBHome {
> public Role create(long roleID) throws CreateException,
> RemoteException;
> public Role findByPrimaryKey(java.lang.Long pk) throws
> FinderException, RemoteException;
> public Enumeration findByName(String roleName) throws
> FinderException, RemoteException;
> public Enumeration findAll() throws FinderException, RemoteException;
> }
>
> all bean classes compile successfully & are deployed in EJB container.
> My client application can successfully retreieve & update bean
> information, but as soon as i try to write code to create new bean using
> create(long pk) it does not compile, giving following compilation error.
>
> RoleClient.java:57: create() in bmall.ejbs.RoleHome cannot be applied to
> (long)
> Role role = home.create(1L);
>
> and here is my client code
>
> public class RoleClient {
>
> public static void main(String[] arg) {
>
> try {
>
> Properties p = new Properties();
> p.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.sun.jndi.rmi.registry.RegistryContextFactory");
> p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
>
> Context initialContext = new InitialContext(p);
>
> RoleHome home = (RoleHome) initialContext.lookup("Role");
>
> //following lines compile and executes with no problem updating
> database record
> Role role = home.findByPrimaryKey(new Long(0L));
> role.setName("updating role name");
>
> //this line fails to compile with above error message
> Role role = home.create(1L);
>
> } catch (Exception e) {
> //probably not the best way to hadle exceptions, but ok for simple
> testing
> e.printStackTrace();
> }
> }
>
> these do not really make sence to me, but most likely i am missing some
> very important.
>
> Thank you very much for your help
>
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".
--
-=- H�l�ne JOANIN -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
mailto:[EMAIL PROTECTED] http://www.evidian.com
Phone: 33.4.76.29.73.53 Fax: 33.4.76.29.76.00
Download our EJB Server JOnAS at http://www.objectweb.org
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".