4 Replies Latest reply on May 31, 2004 7:39 AM by sbocquet

    JBoss audit fields

    sbocquet

      Hi,

      I try to add audit fields on my EJBs. I've added the corresponding tags on my jbosscmp-jdbc.xml file for my beans.

       <entity>
       <ejb-name>Roles</ejb-name>
       <create-table>true</create-table>
       <remove-table>false</remove-table>
       <table-name>Roles</table-name>
      
       <cmp-field>
       <field-name>roleId</field-name>
       <column-name>RoleId</column-name>
       </cmp-field>
       <cmp-field>
       <field-name>name</field-name>
       <column-name>Name</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>description</field-name>
       <column-name>Description</column-name>
       </cmp-field>
       <audit>
       <created-by>
       <field-name>createdBy</field-name>
       <column-name>CreatedBy</column-name>
       </created-by>
       <created-time>
       <field-name>createdTime</field-name>
       <column-name>CreatedTime</column-name>
       </created-time>
       <updated-by>
       <field-name>updatedBy</field-name>
       <column-name>UpdatedBy</column-name>
       </updated-by>
       <updated-time>
       <field-name>updatedTime</field-name>
       <column-name>UpdatedTime</column-name>
       </updated-time>
       </audit>
       </entity>
      


      I have also added security infos on my jboss-web.xml file... and the login mechanism is working correctly (by DatabaseLoginModule).
      <jboss-web>
       <security-domain>java:/jaas/Bet4Fun</security-domain>
      ...
      


      But when Jboss start to deploy my EJB, I have the following error

      18:51:34,241 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: No security-domain configured but created-by specified
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.initGeneratedFields(JDBCAbstractCreateCommand.java:172)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.init(JDBCAbstractCreateCommand.java:85)
      ...
      


      The audit fields are not created in database.
      Is something missing in my descriptors ? Have I forgotten something ?

      Thanks for the help,

        • 1. Re: JBoss audit fields
          aloubyansky

          You are missing security-domain for EJB in jboss.xml. Have a look at jboss_3_2.dtd.

          • 2. Re: JBoss audit fields
            sbocquet

            Hi,

            Thanks a lot for the quick answer...

            I know this isn't the right place, but do you know if it's possible to generate those fields automatically with JBoss IDE (XDoclet), because I can't find a jboss specific tag for it ?

            Cheers,

            • 3. Re: JBoss audit fields
              aloubyansky

              It worked once with the following class level tags:

               * @jboss.audit-created-by
               * field-name="createdBy"
               * column-name="CREATED_BY"
               * @jboss.audit-created-time
               * field-name="createdTime"
               * column-name="CREATED_TIME"
               * @jboss.audit-updated-by
               * field-name="updatedBy"
               * column-name="UPDATED_BY"
               * @jboss.audit-updated-time
               * field-name="updatedTime"
               * column-name="UPDATED_TIME"
              



              • 4. Re: JBoss audit fields
                sbocquet

                Hi,

                Thanks a lot for all.