sam98uele / DB2Project_EJB

3 stars 0 forks source link

Relations Counterpart #16

Closed sam98uele closed 3 years ago

sam98uele commented 3 years ago

Check if the setters update also the other hand of the relation in all the entities for example: in QuestionnaireResponse entity:

public void setStatisticalAnswers(StatisticalAnswer statisticalAnswers) {
    this.statisticalAnswers = statisticalAnswers;
    if(statisticalAnswers != null)
        statisticalAnswers.setQuestionnaireResponse(this); // update the other part of the relation
}

or

public void setMarketingAnswers(List<MarketingAnswer> marketingAnswers) {
    this.marketingAnswers = marketingAnswers;
    if(marketingAnswers != null) {
        for(int i = 0; i<marketingAnswers.size(); i++)
            marketingAnswers.get(i).setQuestionnaireResponse(this);
    }
}

It's good to do this, because they must be always updated

sam98uele commented 3 years ago

And also check, if updated the method, if it is not done by some services. If not ok, else remove it from the service and leave it on the entity! (else it is inserted two times)

alessandriniluca commented 3 years ago

I'll work on this from tomorrow. Since potentially I could touch many entities, please if you modified them do a push, otherwise we will have to manage many merges

sam98uele commented 3 years ago

@alessandriniluca I've made some changes. Please pull it if you don't want too much merges

alessandriniluca commented 3 years ago

Thanks, after lesson I'll pull everything. after having studied a little bit of physics tomorrow, I'll proceed with the relationship issue

sam98uele commented 3 years ago

I suggest you to pull everithing tomorrow before you'll start. Because now I'm working again on other things that must be fixed!

alessandriniluca commented 3 years ago

I'll pull around lunch, if you need more time send me a message with the class you are touching, I'll start with the others, no problem ;)

alessandriniluca commented 3 years ago

With my last push this is done. At the following drive link there are the reasoning I followed: RelationshipsCounterparts.pdf