-->
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.  [ 2 posts ] 
Author Message
 Post subject: AuditInfo pattern not working
PostPosted: Fri Aug 06, 2004 10:58 am 
Newbie

Joined: Fri Aug 06, 2004 10:17 am
Posts: 1
I posted a comment to the AuditInfo pattern page (http://www.hibernate.org/48.html), transcribed below.

The problem is I implemented that pattern and got a different behavior to the stated there. When entering in the onFlushDirty event, I receive the 'entity' object filled with AuditInfo data, and when entering onSave event, in the line:

AuditInfo ai = ((Auditable) entity).getAuditInfo();

the outcome of getAuditInfo is null, failing in the next ai.setCreated line.
I think I left something to configure or define since Hibernate refused to process the mytable.hbm.xml due to the lack of setAuditInfo member (the interface correctly defined only the getter), so I must put the setter in the definition to get Hibernate happy (this may be the root cause of my issue)...
Have any of you dealt with that pattern, what am I missing to do?
Thank you very much,
Leandro


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 03, 2004 1:21 pm 
Newbie

Joined: Fri Sep 03, 2004 1:11 pm
Posts: 1
For second issue you need to initialize auditInfo in your POJO. For example:


Code:
class User implements Auditable {
   
    public User() {
       auditInfo = new AuditInfo();
    }

    .........
    .........

Regards


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

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.