-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: programatically adding meta-value to <any> tag
PostPosted: Thu Jun 09, 2005 1:01 pm 
Newbie

Joined: Tue Jun 07, 2005 1:08 pm
Posts: 10
Hello,

I'm trying to do something a little out of the ordinary using the <any> tag and <meta-value> tags. I'm working on adding auditing to our system, but not in the traditional sense. In a nutshell, I have a marker interface that if any entity implements, it will automatically be audited every time a new record is created, it's modified, or is deleted. I've already got it working using an Interceptor and the <any> tag.

First, here's what my audit class definition looks like using the <any> tag looks currently looks like:

Code:
   <class name="com.blah.audit.Audit" table="Audit">
      <id name="id"
         column="id">
         <generator class="sequence"/>
      </id>   
      <property name="modifiedBy"
         column="modified_by"
         type="string"
         not-null="true"/>

      <property name="modifiedOn"
         column="modified_on"
         type="timestamp"
         not-null="true"/>
         
      
      <property name="auditType"
         type="auditType"
         column="audit_type"/>
         
      <any name="auditable"         
         meta-type="string"
         id-type="long">
         <meta-value value="AuditableObject" class="com.blah.AuditableObject"/>         
         <meta-value value="AnotherAuditableObject" class="com.blah.AnotherAuditableObject"/>         
         <column name="auditable_type"/>         
         <column name="auditable_id"/>
      </any>
   </class>


Now I don't want to constantly come back and modify the mapping file every time a new object becomes auditable and add a <meta-value> to the <any> tag. This could become very lengthy as we add auditing support to a lot of entities.

So is there some hook that I can plug into when hibernate parses the mapping file that I can use to add new meta-value tags whenever a class it's parsing is identified as being auditable?

I looked through the reference manual and nothing jumped out at me.

Any help would be greatly appreciated.

John


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.