Try skipping the <prim-key-class> tag altogether and use <prim-key-field> tag instead. I use Orion and this doesn't happen (Orion figures out how to convert from primitive (int) into type (Integer).
Juan Pablo Lorandi Chief Software Architect Code Foundry Ltd. [EMAIL PROTECTED] Barberstown, Straffan, Co. Kildare, Ireland. Tel: +353-1-6012050 Fax: +353-1-6012051 Mobile: +353-86-2157900 www.codefoundry.com > -----Original Message----- > From: A mailing list for Enterprise JavaBeans development > [mailto:[EMAIL PROTECTED] On Behalf Of Wolf Maya > Sent: Monday, March 29, 2004 2:27 PM > To: [EMAIL PROTECTED] > Subject: return type of abstract get/set methods using CMP > Entity Beans on Weblogic > > > Hello, > > When deploying Entity Bean (packaged in a ear archive with > other components) on BEA weblogic I'm getting the following message: > > ...<prim-key-class> must match the Class used by Primary Key > Field get/set Methods in the Bean Class.... > > I have following settings: > > 1. Oracle 8 database table's primary key: NUMBER NOT NULL > 2. deployment descriptor: > <prim-key-class>java.lang.Integer</prim-key-class> > 3. get/set methods in Bean class: > > public abstract int getOrderNumber(); > public abstract void setOrderNumber(int orderNumber); > > What is the cause for this problem above? I found this > solution in several books and tutorials! I wonder how this works? > > When I change the abstract methods to: > > public abstract java.lang.Integer getOrderNumber(); > public abstract void setOrderNumber(java.lang.Integer orderNumber); > > I'm able to deploy, but when running application I'm getting > an error message about incompatible types (int versus > java.lang.Integer) as my Enity Bean is receiving an int value > created from an Oracle sequence "select orderId.NEXTVAL from DUAL". > > Extract from BEAN CLASS: > ----------------------------- > > // abstract methods > public abstract int getOrderNumber(); > public abstract void setOrderNumber(int n); > > //public abstract java.lang.Integer getOrderNumber(); > //public abstract void setOrderNumber(java.lang.Integer n); > > /* other abstract methods removed from this text file */ > /* select methods removed from here for simplicity */ > > // contract methods > public Integer ejbCreate(int orderNumber, String > orderCustomer) throws CreateException { > > setOrderNumber(orderNumber); > setOrderCustomer(orderCustomer); > return null; > } > > Extract from HOME INTERFACE: > ------------------------------------ > > public OrderMasterEB create(int orderNumber, String orderCustomer) > throws CreateException, RemoteException; > > public OrderMasterEB findByPrimaryKey(Integer primaryKey) > throws RemoteException, FinderException; > > The sequence is being called from a session bean, here is an extract: > --------------------------------------------------------------------- > public int getOrderNumber() { > > int orderNumber = 0; > ....... > stmt.executeQuery("select orderId.NEXTVAL from DUAL"); > resultSet = stmt.getResultSet(); > if ((resultSet != null) && (resultSet.next())) { > orderNumber = resultSet.getInt(1); > } > .......... > return orderNumber; > } > > In the case I'll use java.lang.Integer instead of int, how > can I match it to the result set type? As I'll need to > replace int by java.lang.Integer on every reference of > orderNumber somewhere in the code!? > > Very grateful for any help! > Thanks in advance! > > Best regards, > Wolf > > ============================================================== > ============= > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body of the message "signoff EJB-INTEREST". > For general help, send email to [EMAIL PROTECTED] and > include in the body of the message "help". > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
