java - Creating OrderColumn for OneToMany list mapping on a join table in Hibernate -


i have productjob table , quadrat table. every quadrat can installed on many productjob , every productjob can have between 1 , 4 quadrats of same or different kinds! i'm interested keep order of quadrat installation on product jobs. example first, second, third or forth place! following mapping doesn't create order column on jointable telai_quadrati. problem of mapping? ordercolumn isn't created in anyway!

@entity @table(name = "telai") public class productjob implements iproductjob, iproductjobprocessing{      @embedded private quadratgroup quadrategroup = new quadratgroup(); }  @embeddable public class quadratgroup implements serializable{      @onetomany(targetentity = quadrat.class, cascade = cascadetype.all)      @jointable(         name = "telai_quadrati",          joincolumns = {@joincolumn(name = "dbid", table = "telai")},          inversejoincolumns = {@joincolumn(name = "id", table = "quadrati")})      //@ordercolumn(name = "order")      @indexcolumn(name = "order")      public list<quadrat> getquadratlist(){ //return ordered list of quadrats @ 4 elements} 

and clear quadrats there exists no order use set!

@entity @table(name = "quadrati") public class quadrat implements iquadrat, cloneable, serializable{     @manytomany     @jointable(         name = "telai_quadrati",         joincolumns = @joincolumn(name = "id", table = "quadrati"),         inversejoincolumns = @joincolumn(name = "dbid", table = "telai"))     private set<productjob> productjobs; 

it works if use property access inspite of method access! this:

@onetomany(targetentity = quadrat.class, cascade = cascadetype.all) //@mapkeyjoincolumn(name="indice" , table = "telai_quadrati") @jointable(         name = "telai_quadrati",          joincolumns = {@joincolumn(name = "telaio_id", table = "telai")},          inversejoincolumns = {@joincolumn(name = "quadrato_id", table = "quadrati")}) @ordercolumn(name = "indice") private list<quadrat> quadratlist; 

but wonder why doesn't work method access forces me heavy refactor in project! :(


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -