Hi, I use JBoss IDE (XDoclet) to generate my CMP EJBs, and HSQQLDB as database. I have 2 EJBs, Groups and Roles. A groups can have many roles and a role can have many groups. There is a relation table between them, GroupsRolesLink.
The first time I deploy them, the container creates the tables, the contraints and the indexes correctly. The second time I deploy them, I have the following error | 18:16:54,811 ERROR [EntityContainer] Starting failed | org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.SQLException: Index already exists in statement [CREATE INDEX roleId_idx0 ON GroupsRolesLink (roleId)]) | at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createIndex(JDBCStartCommand.java:305) | at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createCMRIndex(JDBCStartCommand.java:527) | ... | Here are the descriptors generated by XDoclet. ejb-jar.xml | <entity > | <description><![CDATA[Entity bean that represents a role.]]></description> | <display-name>Roles Entity</display-name> | | <ejb-name>Roles</ejb-name> | | <home>org.dyndns.bet4fun.interfaces.RolesHome</home> | <remote>org.dyndns.bet4fun.interfaces.Roles</remote> | <local-home>org.dyndns.bet4fun.interfaces.RolesLocalHome</local-home> | <local>org.dyndns.bet4fun.interfaces.RolesLocal</local> | | <ejb-class>org.dyndns.bet4fun.entity.RolesCMP</ejb-class> | <persistence-type>Container</persistence-type> | <prim-key-class>org.dyndns.bet4fun.interfaces.RolesPK</prim-key-class> | <reentrant>False</reentrant> | <cmp-version>2.x</cmp-version> | <abstract-schema-name>Roles</abstract-schema-name> | <cmp-field > | <description><![CDATA[Get the Id of the role]]></description> | <field-name>roleId</field-name> | </cmp-field> | <cmp-field > | <description><![CDATA[Get the name of the role]]></description> | <field-name>name</field-name> | </cmp-field> | <cmp-field > | <description><![CDATA[Get the description of the role]]></description> | <field-name>description</field-name> | </cmp-field> | | <query> | <query-method> | <method-name>findAll</method-name> | <method-params> | </method-params> | </query-method> | <ejb-ql><![CDATA[SELECT OBJECT(R) FROM Roles AS R]]></ejb-ql> | </query> | <!-- Write a file named ejb-finders-RolesBean.xml if you want to define extra finders. --> | </entity> | | <entity > | <description><![CDATA[Entity bean that represents a Group.]]></description> | <display-name>Groups Entity</display-name> | | <ejb-name>Groups</ejb-name> | | <home>org.dyndns.bet4fun.interfaces.GroupsHome</home> | <remote>org.dyndns.bet4fun.interfaces.Groups</remote> | <local-home>org.dyndns.bet4fun.interfaces.GroupsLocalHome</local-home> | <local>org.dyndns.bet4fun.interfaces.GroupsLocal</local> | | <ejb-class>org.dyndns.bet4fun.entity.GroupsCMP</ejb-class> | <persistence-type>Container</persistence-type> | <prim-key-class>org.dyndns.bet4fun.interfaces.GroupsPK</prim-key-class> | <reentrant>False</reentrant> | <cmp-version>2.x</cmp-version> | <abstract-schema-name>Groups</abstract-schema-name> | <cmp-field > | <description><![CDATA[Get the Id of the group]]></description> | <field-name>groupId</field-name> | </cmp-field> | <cmp-field > | <description><![CDATA[Get the name of the group]]></description> | <field-name>name</field-name> | </cmp-field> | <cmp-field > | <description><![CDATA[Get the description of the group]]></description> | <field-name>description</field-name> | </cmp-field> | | <query> | <query-method> | <method-name>findAll</method-name> | <method-params> | </method-params> | </query-method> | <ejb-ql><![CDATA[SELECT OBJECT(G) FROM Groups AS G]]></ejb-ql> | </query> | <!-- Write a file named ejb-finders-GroupsBean.xml if you want to define extra finders. --> | </entity> | ... | </relationships> | <ejb-relation > | <ejb-relation-name>GroupsRolesRelation</ejb-relation-name> | | <ejb-relationship-role > | <ejb-relationship-role-name>RolesHasGroups</ejb-relationship-role-name> | <multiplicity>Many</multiplicity> | <relationship-role-source > | <ejb-name>Roles</ejb-name> | </relationship-role-source> | <cmr-field > | <cmr-field-name>groups</cmr-field-name> | <cmr-field-type>java.util.Collection</cmr-field-type> | </cmr-field> | </ejb-relationship-role> | | <ejb-relationship-role > | <ejb-relationship-role-name>GroupsHasRoles</ejb-relationship-role-name> | <multiplicity>Many</multiplicity> | <relationship-role-source > | <ejb-name>Groups</ejb-name> | </relationship-role-source> | <cmr-field > | <cmr-field-name>roles</cmr-field-name> | <cmr-field-type>java.util.Collection</cmr-field-type> | </cmr-field> | </ejb-relationship-role> | | </ejb-relation> | </relationships> | and jbosscmp-jdbc.xml | ... | <relationships> | <ejb-relation> | <ejb-relation-name>GroupsRolesRelation</ejb-relation-name> | <relation-table-mapping> | <table-name>GroupsRolesLink</table-name> | <create-table>true</create-table> | </relation-table-mapping> | | <ejb-relationship-role> | <ejb-relationship-role-name>RolesHasGroups</ejb-relationship-role-name> | <fk-constraint>true</fk-constraint> | <key-fields> | <key-field> | <field-name>roleId</field-name> | <column-name>roleId</column-name> | </key-field> | </key-fields> | | </ejb-relationship-role> | <ejb-relationship-role> | <ejb-relationship-role-name>GroupsHasRoles</ejb-relationship-role-name> | <fk-constraint>true</fk-constraint> | <key-fields> | <key-field> | <field-name>groupId</field-name> | <column-name>groupId</column-name> | </key-field> | </key-fields> | | </ejb-relationship-role> | </ejb-relation> | </relationships> | As there is an error on the deployment, my EJB is not deployed ! I don't undestand why this woks the first time and not the second one ! Can someone explains to me how JBoss works on that case, and what is the solution ? Thanks, View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836892#3836892 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836892 ------------------------------------------------------- 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=3149&alloc_id=8166&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user