-->
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: Validation (JSR 303) and persistence for a Map<K,V>
PostPosted: Mon Nov 23, 2009 7:13 am 
Newbie

Joined: Tue Dec 04, 2007 6:24 am
Posts: 13
Hi,
I am trying to save a validated (Validator 4.0.1.GA) entity (hibernate-core 3.5.0-Beta-2) that holds a Map<K, V> of other persisted entities.
I have written a custom ConstraintValidator that handles the validation of such a Map<K, V> (just checking wether the map holds some predefined values).
I can validate the map "by hand" using validator.validate() in my unit tests and the map is correctly filled at validation time.
However when validation framework is called by persistence callbacks, the map is always empty...

I tryed to pinpoint the problem and it seems that the map is not touched in the following method of AbstractType during the merge :

Code:
public Object replace(
      Object original, Object target, SessionImplementor session,
      Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException {
   boolean include;
   if ( isAssociationType() ) {
      AssociationType atype = (AssociationType) this;
      include = atype.getForeignKeyDirection()==foreignKeyDirection;
   }
   else {
      include = ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT==foreignKeyDirection;
   }
   return include ? replace(original, target, session, owner, copyCache) : target;
}


Am I doing something wrong or trying to do something not allowed by persistence or validation spec?
Perhaps it is a bug in the Beta version?
Can I get some feedback please?


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.