Hi! I am currently attempting to implement a container managed relationship between 2 beans. This is a many-to-one relationship between BeanA and BeanB implemented as a foreign key field, the end result being that I can call BeanA.getB() method and have it return me the related BeanBLocal instance.
So, I have beans A & B where bean A is related to a single bean B. That is... BeanA - id INT PK - b_id INT FK to B.id NOT NULL BeanB - id INT PK BeanB exists prior to creating a BeanA, so I pass a BeanBLocal into the ejbCreate and ejbPostCreate of BeanA. In the ejbPostCreate, I call the setBeanB method. The first problem I came across was that the ejbCreate would fail due to the the b_id field being defined as NOT NULL in the database - something we DO want. To get around this, I found the insert-after-ejb-post-create tag and defined this to be true! With this set to true, I am now having the problem that I simply cannot create any entities. They all fail with a javax.ejb.CreateException: Primary key for created instance is null. The reason (I think it is anyway) is that all my objects have an id primary key field defined to come from a database sequence "automagically". That is, I never pass in a primary key to any ejbCreate methods, but rather use the @jboss.persistence auto-increment="true" tag. Does this make sense? Any ideas on how to achieve this result? I am using jboss 3.2.5 and oracle 9i. Any help MUCH appreciated. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852679#3852679 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852679 ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
