Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] JoinTable additional field with constant

Hello.

I have these this relationship between Batch and Item:

TB_ITEM_BATCH
 ID NUMBER

TB_ITEM
 ID NUMBER

RL_ITEM_BATCH_ITEM
 BATCH_ID NUMBER
 ITEM_ID NUMBER
 TP_OPERATION CHAR ('U' : Updated, 'I' : Inserted, 'E' : Excluded)

And mapping:

@Entity @Table
class Batch {

   @Id private Long id;
  
   @ManyToMany
   @JoinTable(name="RL_ITEM_BATCH_ITEM",
    joinColumns=@JoinColumn(name="BATCH_ID"),
    inverseJoinColumn=@JoinColumn(name="ITEM_ID")) //TP_OPERATION = 'I'
   private Set<Item> includedItems;

   @ManyToMany
   @JoinTable(name="RL_ITEM_BATCH_ITEM",
    joinColumns=@JoinColumn(name="BATCH_ID"),
    inverseJoinColumn=@JoinColumn(name="ITEM_ID")) //TP_OPERATION = 'U'
   private Set<Item> updatedItems;

   @ManyToMany
   @JoinTable(name="RL_ITEM_BATCH_ITEM",
    joinColumns=@JoinColumn(name="BATCH_ID"),
    inverseJoinColumn=@JoinColumn(name="ITEM_ID")) //TP_OPERATION = 'E'
   private Set<Item> excludedItems;

}

I am trying to add the TP_OPERATION field using a Customizer. It's easy to add the additional criteria for selection, but i am struggling to find a way to add this to the insert and updates.

Any thoughts?

Thanks

Luciano Greiner

Back to the top