First, you should be using JBoss 3.0.2 (you problem may just go away). 
I'm not an XDoclet expert, so I can't really comment on the xdoclet 
tags, but I do know that you really need to use XDoclet from the XDoclet 
cvs head to fix a bunch of problems.

My guess it Xdoclet is generating a bad primary key class or 
relationship declarations in the ejb-jar.xml file or jbosscmp-jdbc.xml file.

-dain

Victor Batista wrote:
> Hello!
>   I am trying to establish a relationship between two entity beans.
> Although, when I try to call any of the accessors, I get the following
> exception:
> 
> 16:24:46,744 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
> java.lang.ClassCastException: enk.interfaces.PlaceData
>         at
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstance
> alue(JDBCCMRFieldBridge.java:624)
>         at
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setValue(JD
> CCMRFieldBridge.java:563)
>         at
> org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invok
> (EntityBridgeInvocationHandler.java:125)
>         at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
>         at enk.entity.PersonCMP$Proxy.setPlace(<generated>)
> ....
> 
> I am using JBoss 3.0.0 with bundled tomcat 4.0.3. I am using only local
> interfaces to access the relation methods.
> My beans are Person and Place. Each person belongs to one place, and each
> place can have multiple Persons (1-N).
> 
> Person Bean:
> /** 
> *
> * @ejb:relation       name="Person-Place"
> *             role-name="Person-Has-One-Place"
> *             target-multiple="yes"
> * 
> * @jboss:relation     related-pk-field="placeId"
> *                     fk-column="pplaceid"            
> * 
> * @ejb:interface-method view-type="local"
> *                     
> **/
> public abstract enk.interfaces.PlaceData getPlace();
> 
> /**
> * @ejb:interface-method view-type="local"
> **/
> public abstract void setPlace(enk.interfaces.PlaceData place);
> 
> Place Bean:
> /** 
> *
> * @ejb:relation       name="Person-Place"
> *             role-name="Place-Has-Many-Addresses"
> * @ejb:interface-method view-type="local"
> *                     
> **/
> public abstract java.util.Set getPersons();
> 
> /**
> * @ejb:interface-method view-type="local"
> * 
> **/
> public abstract void setPersons(java.util.Set persons);
> 
> 
> 
> 
> I create persons from a Session Bean through the local interface of the
> Person bean:
> /**
>  * insertPerson method.
>  * 
>  * @return an int value.
>  * 
>  * @ejb:interface-method view-type="local"
>  * 
>  */
> public int insertPerson(String person, int placeId)
> //            throws RemoteException
> {
> int ret = 0;
> try {   
> PlaceData place = getPlace(placeId); //Returns the correct PlaceData object
> PersonData lData = null;
> Context lContext = new InitialContext();
>              
> PersonLocalHome lHome = (PersonLocalHome)
> lContext.lookup("ejb/test/PersonLocal");
>               
> lData = new PersonData();
> lData.setName(person);
> PersonLocal lEntity = lHome.create( lData, place );
> 
>                       
> PersonPK pk = (PersonPK) lEntity.getPrimaryKey();
> ret = pk.getId();                     
> } catch ( Exception e ) {
>   e.printStackTrace();
> }     
> return ret;
> }
> 
> The ejbCreate of the Person Bean is as follows:
> public PersonPK ejbCreate(PersonData key, PlaceData place)
>       throws
>          InvalidValueException,
>          EJBException,
>          CreateException
> {     
> setId(count++);
> setName(key.getName());
> setPlace(place);
> return null;
> }
> 
> First of all, I create a few places.
> When I try to create the one person, I get the exception above.
> 
> I would appreciate any help. I am getting crazy .....
> 
> 
> Thanks in advance,
>     Victor Batista
> ------------------------------------------------------------------
> Victor Nelson Marques Batista
> Present Technologies, Lda.
> 
> 
> http://www.present-technologies.com
> 
> Praceta Alberto de Oliveira, 18 - 1º
> 3000 - 015 Coimbra Portugal
> Phone (+351) 239 781834
> Fax     (+351) 239 781835
> 
> 
> mailto:[EMAIL PROTECTED]
> ------------------------------------------------------------------ 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user


-- 
xxxxxxxxxxxxxxxxxxxxxxxx
Dain Sundstrom
Chief Architect JBossCMP
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to