1

If I join two tables on two columns, then all works correctly

@JoinColumns({
    @JoinColumn(name = "linkedObjectID", referencedColumnName = "id"),
    @JoinColumn(name = "linkedObjectName", referencedColumnName = "linkedObjectName")
})

Result:

Hibernate: 
    update
        framework_files 
    set
        linkedObjectID=? ,
        linkedObjectName=? 
    where
        id=?

If I join only by one column plus with @Where, then Hibernate will update only one column, what passed through join?

@Where(clause = "linkedObjectName='publicSitePortfolioWorks'")
@JoinColumns({
    @JoinColumn(name = "linkedObjectID", referencedColumnName = "id"),
})

Hibernate: 
    update
        framework_files 
    set
        linkedObjectID=? 
    where
        id=?

How to pass column value with annotation? I want to remove column linkedObjectName from parent table and pass value to the column linkedObjectName in the child table through annotation.

Arthur
  • 3,253
  • 7
  • 43
  • 75
  • Check out the Filter and FilterDef annotations: http://stackoverflow.com/questions/6919686/annotation-to-filter-results-of-a-onetomany-association – buftlica Mar 06 '15 at 14:52

0 Answers0