Hello,
What I am doing is just verifying Richard's EJB book
examples. I am stucked now at the ReservationBean,
which I can't deploy.
I get the output:
"ReservationEJBeanGroup.ejbgrp": Entity Bean:
"ReservationBean" Could not find
container-managed field corresponding to primary key
field: public int
com.titan.reservation.ReservationPK.id
Is there in JBuilder somewhat, I have to set for the
ReservationBean?
Please look to the work I already did:
CREATE TABLE RESERVATION
(
CUSTOMER_ID INT,
CABIN_ID INT,
CRUISE_ID INT,
PRICE NUMERIC
)
Here the code fragment for the ReservationBean:
package com.titan.reservation;
import com.titan.cabin.*;
import com.titan.cruise.*;
import com.titan.customer.*;
import javax.ejb.*;
import java.rmi.RemoteException;
public class ReservationBean implements
javax.ejb.EntityBean {
public int customerID;
public int cruiseID;
public int cabinID;
public double price;
public javax.ejb.EntityContext ejbContext;
public ReservationPK ejbCreate(Customer customer,
Cruise cruise, Cabin cabin, double price) {
try {
this.customerID =
((CustomerPK)customer.getPrimaryKey()).id;
this.cruiseID =
((CruisePK)cruise.getPrimaryKey()).id;
this.cabinID =
((CabinPK)cabin.getPrimaryKey()).id;
this.price = price;
}
catch (RemoteException re) {
throw new EJBException(re);
}
return null;
}
...
Here the ejb-jar.xml file:
<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems,
Inc.//DTD Enterprise JavaBeans
1.1//EN'
'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>ReservationBean</ejb-name>
<home>com.titan.cruisereservation.ReservationHome</home>
<remote>com.titan.cruisereservation.Reservation</remote>
<ejb-class>com.titan.cruisereservation.ReservationBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.titan.cruisereservation.ReservationPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-field>
<field-name>customerID</field-name>
</cmp-field>
<cmp-field>
<field-name>cruiseID</field-name>
</cmp-field>
<cmp-field>
<field-name>cabinID</field-name>
</cmp-field>
<cmp-field>
<field-name>price</field-name>
</cmp-field>
<resource-ref>
<res-ref-name>jdbc/ds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ReservationBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
And the ejb-inprise.xml file(I use IAS4.1.1):
<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE inprise-specific PUBLIC '-//Inprise
Corporation//DTD Enterprise
JavaBeans 1.1//EN'
'http://www.borland.com/devsupport/appserver/dtds/ejb-inprise.dtd'>
<inprise-specific>
<enterprise-beans>
<entity>
<ejb-name>ReservationBean</ejb-name>
<bean-home-name>Reservation</bean-home-name>
<resource-ref>
<res-ref-name>jdbc/ds</res-ref-name>
<jndi-name>reservation/datasource</jndi-name>
<cmp-resource>True</cmp-resource>
</resource-ref>
<cmp-info>
<database-map>
<table>RESERVATION</table>
<column-map>
<field-name>customerID</field-name>
<column-name>CUSTOMER_ID</column-name>
</column-map>
<column-map>
<field-name>cruiseID</field-name>
<column-name>CRUISE_ID</column-name>
</column-map>
<column-map>
<field-name>cabinID</field-name>
<column-name>CABIN_ID</column-name>
</column-map>
<column-map>
<field-name>price</field-name>
<column-name>PRICE</column-name>
</column-map>
</database-map>
</cmp-info>
</entity>
</enterprise-beans>
<datasource-definitions>
<datasource>
<jndi-name>reservation/datasource</jndi-name>
<url>jdbc:borland:dslocal:F:/JBProj/TitanCruises/database/TitanCruises.jds</url>
<username>sys</username>
<password>sys</password>
<driver-class-name>com.borland.datastore.jdbc.DataStoreDriver</driver-class-name>
</datasource>
</datasource-definitions>
</inprise-specific>
I can't see anything wrong with that. In my opinion
this ReservationPK also fullfill the container
requirement for unique beans since it's built by 3
table columns.
regards,
Darya
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
===========================================================================
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".