Actually, i was incorrect in my first post where i said it happens on redeployment (or restart).
Restarting jboss resolves the problem. The problem only happens on hotdeployments. .peter -----Original Message----- From: Dain Sundstrom [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 2:32 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] [JBossCMP2.0] Compound Primary Keys and CMR fields You have not implemented equals in your pk class. That code shouldn't even compile? -dain Luttrell, Peter wrote: > I have an entity bean with a compound primary key, where one of the > fields is a cmr field. The entity bean works perfectly after the first > deployment. I can set primary key, as well as do lookups and such. But > after I redeploy (or restart) I get the following error, whenever i > attempt to findByPrimaryKey for a valid record: > > 13:45:34,612 ERROR [STDERR] javax.ejb.FinderException: Find failed: > javax.ejb.EJBException: Internal > error getting results for field member key > Embedded Exception > Unable to load a ResultSet column into a variable of type '....MyKey' > 13:45:34,675 ERROR [STDERR] at > org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(J > DBCAbstractQueryCommand.java:143) > 13:45:34,690 ERROR [STDERR] at > org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBC > FindEntityCommand.java:44) > ... > > My question is, should what I am doing work? If so then this is a bug > (or some other problem). If not, the beanvalidation should detect this > senerio and not allow the beans deployment. > > Here's some more details on what I am doing: > > <entity> > <ejb-name>MyBean</ejb-name> > <prim-key-class>....MyKey</prim-key-class> > ... > <cmp-field><field-name>key</field-name></cmp-field> > <cmp-field><field-name>year</field-name></cmp-field> > <cmp-field><field-name>month</field-name></cmp-field> > <primkey-field>key</primkey-field> > ... > </entity> > > > <ejb-relation> > <ejb-relation-name>....</ejb-relation-name> > <ejb-relationship-role> > <ejb-relationship-role-name>.....</ejb-relationship-role-name> > <multiplicity>One</multiplicity> > <relationship-role-source> > <ejb-name>...some other bean....</ejb-name> > </relationship-role-source> > <cmr-field> > <cmr-field-name>allMyBeans</cmr-field-name> > <cmr-field-type>java.util.Collection</cmr-field-type> > </cmr-field> > </ejb-relationship-role> > <ejb-relationship-role> > <ejb-relationship-role-name>.....</ejb-relationship-role-name> > <multiplicity>Many</multiplicity> > <relationship-role-source> > <ejb-name>MyBean</ejb-name> > </relationship-role-source> > <cmr-field> > <cmr-field-name>related</cmr-field-name> > </cmr-field> > </ejb-relationship-role> > </ejb-relation> > > public class MyKey implements Serializable{ > > private String name; > private Integer month; > private Integer year; > > public MyKey(){ > } > > public MyKey(Integer year, Integer month, String name){ > this.name= name; > this.month = month; > this.year = year; > } > > public String getName(){ > return name; > } > > public Integer getMonth(){ > return month; > } > > public Integer getYear(){ > return year; > } > > public boolean equals(Object obj){ > } > > public int hashCode(){ > return getName().hashCode() ^ getYear().hashCode() ^ > getMonth().hashCode(); > } > } > > public abstract class MyBeanimplements EntityBean { > > public abstract MyKey getKey(); > public abstract Integer getYear(); > public abstract Integer getMonth(); > > public abstract void setKey(MyKey key); > public abstract void setYear(Integer year); > public abstract void setMonth(Integer month); > > public abstract RelatedLocal getRelated(); > public abstract void setRelated(RelatedLocal related); > > public MyKey ejbCreate(Integer year, Integer month, String name) > throws CreateException { > > MyKey key = new MyKey(year, month, name); > setKey(key); > > setYear(year); > setMonth(month); > return null; > } > > public void ejbPostCreate(Integer year, Integer month, String name) { > > RelatedHomeLocal home = > RelatedLocal related = home.findByPrimaryKey(name); > setRelated(related); > } > ..... > } > ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user This transmission contains information solely for intended recipient and may be privileged, confidential and/or otherwise protect from disclosure. If you are not the intended recipient, please contact the sender and delete all copies of this transmission. This message and/or the materials contained herein are not an offer to sell, or a solicitation of an offer to buy, any securities or other instruments. The information has been obtained or derived from sources believed by us to be reliable, but we do not represent that it is accurate or complete. Any opinions or estimates contained in this information constitute our judgment as of this date and are subject to change without notice. Any information you share with us will be used in the operation of our business, and we do not request and do not want any material, nonpublic information. Absent an express prior written agreement, we are not agreeing to treat any information confidentially and will use any and all information and reserve the right to publish or disclose any information you share with us. ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user