[hibernate-issues] [Hibernate-JIRA] Commented: (HV-281) validation of a persisted map
Edmondo Porcu (JIRA)
noreply at atlassian.com
Tue Mar 13 11:37:49 EDT 2012
[ https://hibernate.onjira.com/browse/HV-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45930#comment-45930 ]
Edmondo Porcu commented on HV-281:
----------------------------------
The same happens with @ElementCollection: I can't merge an element collection containing a List correctly because the values are not copied correctly and my initialization fails :(
> validation of a persisted map
> -----------------------------
>
> Key: HV-281
> URL: https://hibernate.onjira.com/browse/HV-281
> Project: Hibernate Validator
> Issue Type: Bug
> Components: engine
> Environment: hibernate-core 3.5.0-Beta-3
> Validator 4.0.1.GA
> MySQL 5.1
> Reporter: thogau
> Assignee: Hardy Ferentschik
> Fix For: 4.1.0.Beta2
>
> Attachments: EntityWithCollection.java, mapValidation.zip, testcase.zip
>
>
> Hi,
> I am trying to validate an entity that holds a Map<K, V> of other persisted entities (just checking wether the map holds some predefined values).
> I can validate it "by hand" using validator.validate() and my map is correctly filled at validation time
> However when validation framework is called by persistence callbacks, my map is always empty...
> I am using Validator 4.0.1.GA and hibernate-core 3.5.0-Beta-2
> 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;
> }
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list