[JBoss-user] [Persistence CMP/JBoss] - Method is not a known CMP field accessor, CMR field accessor
Hi, I've got a bunch of CMPs (running on JBoss 3.2.5) representing an order with orderLine. Here are the links: Order -1*- OrderLine -11- Item | V Customer My problem comes when I want to create an order. With existing Customer and Items, I want to create (in one go) an Order with its OrderLines. When I do that I've got the following exception 15:53:01,187 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract java.lang.String com.yaps. | petstore.server.service.order.OrderService.createOrder(java.lang.String,java.util.Map) throws javax.ejb.CreateException, | com.yaps.petstore.common.exception.CheckException,java.rmi.RemoteException, causedBy: | javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=setOrder | at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:83) | at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62) | at com.yaps.petstore.server.domain.orderline.OrderLineBean$Proxy.setOrder(generated) | at com.yaps.petstore.server.domain.orderline.OrderLineBean.ejbPostCreate(Unknown Source) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at org.jboss.ejb.plugins.CMPPersistenceManager.postCreateEntity(CMPPersistenceManager.java:235) | at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.postCreateEntity(CachedConnectionInterceptor | .java:277) I've localised the problem but I can't solve it or explain it. It's in the postCreate of the OrderLine CMP when it calls the setOrder method. If I take it our, the exception doesn't occur but in the database I've got a foreign key set to null, normal. public String ejbCreate(int quantity, double unitCost, OrderLocal order, ItemLocal item) throws CreateException, CheckException { | | setId(getUniqueId(COUNTER_NAME)); | setUnitCost(unitCost); | setQuantity(quantity); | return null; | } | | public void ejbPostCreate(int quantity, double unitCost, OrderLocal order, ItemLocal item) throws CreateException, CheckException { | | setOrder(order); | setItem(item); | } The method setOrder IS a CMR Method and it's declared abstract like all the other getters and setters public abstract int getQuantity(); | public abstract void setQuantity(final int quantity); | | public abstract double getUnitCost(); | public abstract void setUnitCost(final double unitCost); | | public abstract OrderLocal getOrder(); | public abstract void setOrder(final OrderLocal order); | | public abstract ItemLocal getItem(); | public abstract void setItem(final ItemLocal item); And here are bits of the ejb-jar.xml entity | display-nameOrderEB/display-name | ejb-nameOrderBean/ejb-name | local-homecom.yaps.petstore.server.domain.order.OrderLocalHome/local-home | localcom.yaps.petstore.server.domain.order.OrderLocal/local | ejb-classcom.yaps.petstore.server.domain.order.OrderBean/ejb-class | persistence-typeContainer/persistence-type | prim-key-classjava.lang.String/prim-key-class | reentrantFalse/reentrant | cmp-version2.x/cmp-version | abstract-schema-nameOrder/abstract-schema-name | cmp-field | field-nameid/field-name | /cmp-field | cmp-field | field-namestatus/field-name | /cmp-field | cmp-field | field-nameorderDate/field-name | /cmp-field | cmp-field | field-namefirstname/field-name | /cmp-field | cmp-field | field-namelastname/field-name | /cmp-field | primkey-fieldid/primkey-field | /entity | | entity | display-nameOrderLineEB/display-name | ejb-nameOrderLineBean/ejb-name | local-homecom.yaps.petstore.server.domain.orderline.OrderLineLocalHome/local-home | localcom.yaps.petstore.server.domain.orderline.OrderLineLocal/local | ejb-classcom.yaps.petstore.server.domain.orderline.OrderLineBean/ejb-class | persistence-typeContainer/persistence-type | prim-key-classjava.lang.String/prim-key-class | reentrantFalse/reentrant | cmp-version2.x/cmp-version |
[JBoss-user] [Persistence CMP/JBoss] - Re: Method is not a known CMP field accessor, CMR field acce
I've finally found the problem, I didn't take in account that the Order - OrderLine relationship was bidirectional. Here is the ejb-jar.xml that works, I've just added the cmr-field | cmr-field-nameorder/cmr-field-name | /cmr-field It looks like that ejb-relation | ejb-relation-nameOrderBean - OrderLineBean/ejb-relation-name | ejb-relationship-role | ejb-relationship-role-nameorder-has-orderLines/ejb-relationship-role-name | multiplicityOne/multiplicity | relationship-role-source | ejb-nameOrderBean/ejb-name | /relationship-role-source | cmr-field | cmr-field-nameorderLines/cmr-field-name | cmr-field-typejava.util.Collection/cmr-field-type | /cmr-field | /ejb-relationship-role | | ejb-relationship-role | ejb-relationship-role-nameorderLine-belongs_to-order/ejb-relationship-role-name | multiplicityMany/multiplicity | relationship-role-source | ejb-nameOrderLineBean/ejb-name | /relationship-role-source | cmr-field | cmr-field-nameorder/cmr-field-name | /cmr-field | /ejb-relationship-role | /ejb-relation View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3865233#3865233 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3865233 --- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag--drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - CMP With object attributes
Hi, I've got existing POJO/DAO classes and I'm converting them into CMP Beans. Works fine. I've reached the case where I have a class Customer with an attribute Address (another class). public final class Customer extends PersistentObject { private String _id; private String _firstname; private String _lastname; private final Address _address = new Address(); } public final class Address { private String _street1; private String _city; private String _zipcode; } To turn that into a CMP you would thing 'well, let's create 2 CMPs, one for Customer and one for address with a relation'. The problem is that I only have one DB Table t_customer with all attributes, but there's not table for address CREATE TABLE T_CUSTOMER( id VARCHAR(10), PRIMARY KEY(id), firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, street1 VARCHAR(50), city VARCHAR(25), zipcode VARCHAR(10)); And I don't want to create a second table (t_address). How can I use a CMP and map its composed attributes (address) into the table t_customer ? If I creat a BMP instead I will have problems with relationship between CMPs and BMPs. Any help, thanks, Antonio View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3863192#3863192 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3863192 --- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag--drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: Bean not found for relation
Thanks, I've put all the entities in only one jar with only one deployment descriptor and it's working fine. Is the constraint both beans have to be defined in the same dd if you have a cmr relationship between them defined in the spec (I haven't found anything) or is this a JBoss limitation ? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3835923#3835923 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3835923 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user