Problem with relation between BMP EJB and CMP EJB
jbosskiki Jul 5, 2004 1:52 PMHi,
I'm using JBOSS 3.2.3 with Oracle 8i. I've two EJB User and Country, User is a BMP and Country a CMP. When I try to deploy I've this error:
"Entity: User not found for relation : User Country.
Code:
/** * @ejb.bean * name="User" * type="BMP" * primkey-field="idUser" * view-type = "local" * * @ejb.value-object * match = "*" * * @ejb.dao * class = "seryx.dictionnary.bean.bmp.dao.UserDAO" * impl-class = "seryx.dictionnary.bean.bmp.dao.UserDAOImpl" * * @ejb.util * generate = "physical" * * @ejb.pk * generate = "false" * class = "java.lang.Long" * package = "java.lang" * * @jboss.persistence * create-table="false" * remove-table="false" */ public abstract class UserEJB implements EntityBean { Long idUser; String login; String password; String email; Long idCountry; Long idState; int standBy; .... /** * Returns user's country. * * @ejb.interface-method * view-type="local" * * @ejb.relation * name = "User-Country" * role-name = "User-has-a-Country" * target-multiple = "yes" * target-role-name="Country-has-Users" * target-ejb="Country" * * @jboss.relation * fk-column = "IdCountry" * related-pk-field = "idCountry" * fk-constraint = "true" * * @dao.call * name = "getCountry" * * @return the country. */ public abstract CountryLocal getCountry(); /** * Sets User's country. * * @param seryx.dictionnary.bean.cmp.CountryLocal the new Country value * * @ejb.interface-method * view-type = "local" * * @dao.call * name = "setCountry" */ public abstract void setCountry(UserLocal country); } /** * @ejb.bean * name="Country" * type="CMP" * primkey-field="idCountry" * schema="sCountry" * cmp-version="2.x" * view-type = "local" * * @ejb.persistence * table-name="Country" * * @ejb.finder * view-type="local" * signature="java.util.Collection findAll()" * query="SELECT OBJECT(o) FROM sCountry o" * * @ejb.value-object * name="Country" * match="*" * * @ejb.util * generate = "physical" * * @jboss.persistence * create-table="false" * remove-table="false" * * @jboss.entity-command * name="CountryPk" * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand" * * @jboss.entity-command-attribute * name="sequence" * value="seq_country_id" * */ public abstract class CountryEJB implements EntityBean { /** * The ejbCreate method. * * @ejb.create-method */ public java.lang.Long ejbCreate(Long idCountry, String country) throws javax.ejb.CreateException { setIdCountry(idCountry); setCountry(country); return null; } /** * The container invokes this method immediately after it calls ejbCreate. * */ public void ejbPostCreate(Long idCountry, String country) throws javax.ejb.CreateException { } /** * Returns the idCountry * @return the idCountry * * @ejb.persistent-field * @ejb.persistence * column-name="IdCountry" * sql-type="number" * @ejb.pk-field * @ejb.interface-method */ public abstract java.lang.Long getIdCountry(); /** * Sets the idCountry * * @param java.lang.Long the new idCountry value * * @ejb.interface-method */ public abstract void setIdCountry(java.lang.Long idCountry); /** * Returns the country * @return the country * * @ejb.persistent-field * @ejb.persistence * column-name="Country" * sql-type="varchar" * * @ejb.interface-method */ public abstract java.lang.String getCountry(); /** * Sets the country * * @param java.lang.String the new country value * * @ejb.interface-method */ public abstract void setCountry(java.lang.String country); /** * @ejb.interface-method * view-type = "local" */ public abstract CountryValue getCountryValue(); /** * Sets the CountryValue * * @param seryx.dictionnary.bean.cmp.CountryValue the new CountryValue * * @ejb.interface-method * view-type = "local" */ public abstract void setCountryValue(CountryValue value); /** * return the states * @return the states * * @ejb.relation * name="Country-State" * role-name="Country-has-States" * target-mulitple="no" * target-role-name="State-has-a-Country" * target-ejb="State" * * @jboss.target-relation * related-pk-field="idCountry" * fk-column="IdCountry" * * @ejb.interface-method */ public abstract Collection getStates(); /** * Sets the states * * @param java.util.Collection the new states. * * @ejb.interface-method */ public abstract void setStates(Collection states); }
Thanks for any help. I'm trying to solve it for several weeks. Sorry for my english which is not so good!...
Mike