Announcement Announcement Module
Collapse
No announcement yet.
BIG Hibernate Validator Problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BIG Hibernate Validator Problem

    Hi,

    I have a class Question with some fields and an one to many with FormattedTextChoice.
    Code:
    @Entity
    
    public class RadioBoxQuestion{
    	private String request;
    	...
    
    	@Size(min = 2, max = Question.MAXIMUM_CHOICES_PER_QUESTION)
    	@OneToMany(fetch = FetchType.EAGER, cascade =  CascadeType.ALL)
    	@JoinColumn(name = "RADIO_BOX_QUESTION_ID")
    	@OrderBy(clause = "position ASC")
    	@ForeignKey(name="CHOICES__RADIO_BOX_QUESTIONS_FK")
    	public Set<FormattedTextChoice> getRadioBoxChoiceSet() {
    		return radioBoxChoiceSet;
    	}
    	...
    	@AssertTrue
    	public boolean validateChoicePositions() {
    		 System.out.println("RadioBoxQuestion.validateChoicePositions(!!!!!!!)");
    		return Utils.validateElementsPosition(radioBoxChoiceSet);
    		
    	}
    }
    The problem is that whenever I try to update any of FormattedTextChoice objects and I do NOT modify the Question request field, the method annotated with @asserttrue (validateChoicePositions) is ignored!!!

    So a code like:
    ...
    myFormattedTextChoice = ...;
    myFormattedTextChoice.setPosition(9999);
    questioningDao.update(question);

    will result in corrupted data for me.


    But, if I modify also the request field, then will work as expected, and will execute the validateChoicePositions method.

    Any clues?

  • #2
    any clues, guys?

    Thank you in advance

    Comment


    • #3
      Still no ideas?

      Comment

      Working...
      X