RE: Re[2]: [JBoss-user] JBossCMP Change Column Names in CMR
I found the solution to my problem, so i thought i'd post it in case anyone else runs into the same problem. In the jbosscmp-jdbc.xml file, for the field-name fields, instead of the cmr fields that i was specifying, you need to specify the primarykey fields for the related beans. Thus this: User-Roles User_Role Role-Belongs-To-User roles role_name User-has-multiple-Roles users user_name Becomes this: User-Roles User_Role Role-Belongs-To-User name role_name User-has-multiple-Roles userName user_name To figure it out, I used middlegen to reverse engineer my dbschema, at which point i noticed that the field-names weren't what I was doing. .peter -Original Message- From: Alex Loubyansky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 11:13 AM To: Luttrell, Peter Subject: Re[2]: [JBoss-user] JBossCMP Change Column Names in CMR AFAIK, DD's are correct (with my remark). Do you really have in the beans abstract accessors for cmr users and roles? Wednesday, July 31, 2002, 6:47:55 PM, you wrote: LP> I actually tried that and it didn't work either. LP> The only difference is that instead of complaining that it couldn't find LP> "roles", now it complains that it can't find "users". LP> Any other ideas? LP> thanks. LP> .peter LP> -Original Message- LP> From: Alex Loubyansky [mailto:[EMAIL PROTECTED]] LP> Sent: Wednesday, July 31, 2002 1:11 AM LP> To: Peter Luttrell LP> Subject: Re: [JBoss-user] JBossCMP Change Column Names in CMR LP> You need to interchange key-fields for ejb-relationship-role's in LP> jbosscmp-jdbc.xml. LP> I.e. LP> Role-Belongs-To-User> LP> LP> LP> roles LP> role_name LP> LP> LP> ... LP> alex LP> Wednesday, July 31, 2002, 1:45:57 AM, you wrote: PL>> How do you change the column names for a table generated by a LP> MANY-to-MANY PL>> CMR? PL>> Here's an example of what i've tried: PL>> ejb-jar.xml: PL>> PL>> User-Roles PL>> PL>> LP> User-has-multiple-Roles> PL>> Many PL>> PL>> Users PL>> PL>> PL>> roles PL>> java.util.Set PL>> PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> Many PL>> PL>> Roles PL>> PL>> PL>> users PL>> java.util.Set PL>> PL>> PL>> PL>> My understanding of how to do this is via this entry in LP> jbosscmp-jdbc.xml: PL>> PL>> User-Roles PL>> PL>> User_Role PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> PL>> PL>> users PL>> user_name PL>> PL>> PL>> PL>> PL>> LP> User-has-multiple-Roles> PL>> PL>> PL>> roles PL>> role_name PL>> PL>> PL>> PL>> PL>> But the problem is that jboss complains ~ It doesn't seam to be able to PL>> locate the "users" or "roles" field-name's that i've declared. Here's LP> the PL>> summary error: PL>> [ObjectName: jboss.j2ee:service=EJB,jndiName=myBEAN PL>> state: FAILED PL>> I Depend On: PL>> Depends On Me: org.jboss.deployment.DeploymentException: CMP field for PL>> key not found: field name=roles, ObjectName: PL>> jboss.j2ee:service=EJB,jnd
RE: Re[2]: [JBoss-user] JBossCMP Change Column Names in CMR
Yep, here's the snipped out of my ejb-jar.xml: User-Roles User-has-multiple-Roles Many Users roles java.util.Set Role-Belongs-To-User Many Roles users java.util.Set Do I need todo something else here to make the other work? It's deployed fine and the code works perfectly. I only run into problems when i added the section in the jbosscmp-jdbc.xml to attempt to change the column-names. thanks. .peter -Original Message- From: Alex Loubyansky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 11:13 AM To: Luttrell, Peter Subject: Re[2]: [JBoss-user] JBossCMP Change Column Names in CMR AFAIK, DD's are correct (with my remark). Do you really have in the beans abstract accessors for cmr users and roles? Wednesday, July 31, 2002, 6:47:55 PM, you wrote: LP> I actually tried that and it didn't work either. LP> The only difference is that instead of complaining that it couldn't find LP> "roles", now it complains that it can't find "users". LP> Any other ideas? LP> thanks. LP> .peter LP> -Original Message- LP> From: Alex Loubyansky [mailto:[EMAIL PROTECTED]] LP> Sent: Wednesday, July 31, 2002 1:11 AM LP> To: Peter Luttrell LP> Subject: Re: [JBoss-user] JBossCMP Change Column Names in CMR LP> You need to interchange key-fields for ejb-relationship-role's in LP> jbosscmp-jdbc.xml. LP> I.e. LP> Role-Belongs-To-User> LP> LP> LP> roles LP> role_name LP> LP> LP> ... LP> alex LP> Wednesday, July 31, 2002, 1:45:57 AM, you wrote: PL>> How do you change the column names for a table generated by a LP> MANY-to-MANY PL>> CMR? PL>> Here's an example of what i've tried: PL>> ejb-jar.xml: PL>> PL>> User-Roles PL>> PL>> LP> User-has-multiple-Roles> PL>> Many PL>> PL>> Users PL>> PL>> PL>> roles PL>> java.util.Set PL>> PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> Many PL>> PL>> Roles PL>> PL>> PL>> users PL>> java.util.Set PL>> PL>> PL>> PL>> My understanding of how to do this is via this entry in LP> jbosscmp-jdbc.xml: PL>> PL>> User-Roles PL>> PL>> User_Role PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> PL>> PL>> users PL>> user_name PL>> PL>> PL>> PL>> PL>> LP> User-has-multiple-Roles> PL>> PL>> PL>> roles PL>> role_name PL>> PL>> PL>> PL>> PL>> But the problem is that jboss complains ~ It doesn't seam to be able to PL>> locate the "users" or "roles" field-name's that i've declared. Here's LP> the PL>> summary error: PL>> [ObjectName: jboss.j2ee:service=EJB,jndiName=myBEAN PL>> state: FAILED PL>> I Depend On: PL>> Depends On Me: org.jboss.deployment.DeploymentException: CMP field for PL>> key not found: field name=roles, ObjectName: PL>> jboss.j2ee:service=EJB,jndiName=myBEAN PL>> with the following exception: PL>> 17:34:33,434 WARN [ServiceController] Problem starting service PL>> jboss.j2ee:service=EJB,jndiName=myBEAN PL>> org.jboss.deployment.DeploymentException: CMP field for key not found: PL>> field name=roles PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKey LP> Fields(JDBCRe PL>> lationshipRoleMetaData.java:374) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JD LP> BCRelationshi PL>> pRol
Re[2]: [JBoss-user] JBossCMP Change Column Names in CMR
AFAIK, DD's are correct (with my remark). Do you really have in the beans abstract accessors for cmr users and roles? Wednesday, July 31, 2002, 6:47:55 PM, you wrote: LP> I actually tried that and it didn't work either. LP> The only difference is that instead of complaining that it couldn't find LP> "roles", now it complains that it can't find "users". LP> Any other ideas? LP> thanks. LP> .peter LP> -Original Message- LP> From: Alex Loubyansky [mailto:[EMAIL PROTECTED]] LP> Sent: Wednesday, July 31, 2002 1:11 AM LP> To: Peter Luttrell LP> Subject: Re: [JBoss-user] JBossCMP Change Column Names in CMR LP> You need to interchange key-fields for ejb-relationship-role's in LP> jbosscmp-jdbc.xml. LP> I.e. LP> Role-Belongs-To-User> LP> LP> LP> roles LP> role_name LP> LP> LP> ... LP> alex LP> Wednesday, July 31, 2002, 1:45:57 AM, you wrote: PL>> How do you change the column names for a table generated by a LP> MANY-to-MANY PL>> CMR? PL>> Here's an example of what i've tried: PL>> ejb-jar.xml: PL>> PL>> User-Roles PL>> PL>> LP> User-has-multiple-Roles> PL>> Many PL>> PL>> Users PL>> PL>> PL>> roles PL>> java.util.Set PL>> PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> Many PL>> PL>> Roles PL>> PL>> PL>> users PL>> java.util.Set PL>> PL>> PL>> PL>> My understanding of how to do this is via this entry in LP> jbosscmp-jdbc.xml: PL>> PL>> User-Roles PL>> PL>> User_Role PL>> PL>> PL>> LP> Role-Belongs-To-User> PL>> PL>> PL>> users PL>> user_name PL>> PL>> PL>> PL>> PL>> LP> User-has-multiple-Roles> PL>> PL>> PL>> roles PL>> role_name PL>> PL>> PL>> PL>> PL>> But the problem is that jboss complains ~ It doesn't seam to be able to PL>> locate the "users" or "roles" field-name's that i've declared. Here's LP> the PL>> summary error: PL>> [ObjectName: jboss.j2ee:service=EJB,jndiName=myBEAN PL>> state: FAILED PL>> I Depend On: PL>> Depends On Me: org.jboss.deployment.DeploymentException: CMP field for PL>> key not found: field name=roles, ObjectName: PL>> jboss.j2ee:service=EJB,jndiName=myBEAN PL>> with the following exception: PL>> 17:34:33,434 WARN [ServiceController] Problem starting service PL>> jboss.j2ee:service=EJB,jndiName=myBEAN PL>> org.jboss.deployment.DeploymentException: CMP field for key not found: PL>> field name=roles PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKey LP> Fields(JDBCRe PL>> lationshipRoleMetaData.java:374) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JD LP> BCRelationshi PL>> pRoleMetaData.java:157) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRela LP> tionMetaData. PL>> java:308) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCA LP> pplicationMet PL>> aData.java:383) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLo LP> ader.java:75) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCS LP> toreManager.j PL>> ava:677) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreMa LP> nager.java:38 PL>> 9) PL>> at PL>> LP> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java: LP> 339) PL>> at PL>> LP> org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java LP> :198) PL>> at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376) PL>> at org.jboss.ejb.Container.invoke(Container.java:793) PL>> at LP> org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055) PL>> at PL>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491) PL>> at PL>> LP> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.jav LP> a:950) PL>> at $Proxy6.start(Unknown Source) PL>> at PL>> org.jboss.system.ServiceController.start(ServiceController.java:384) PL>> at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) PL>> at PL>> LP> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl LP> .java:25) PL>>