Author | Message |
---|---|
lmann2
Posts: 156
|
Posted 18:20 Mar 11, 2015 |
I have a strange error. I implemented ordercolumn in my application and now in the view (not in the data) it adds the spaces for the previous two(or however many) checkpoints when I display my plan. The plan is place into context by the dao (which acesses cell and cell_checkpoints). It's quite odd I can't figure it out. In the image attached the number value is the length of cell.checkpoints. |
hgadhia
Posts: 52
|
Posted 19:42 Mar 11, 2015 |
By my understanding, I feel your problem is right there in the cells_checkpoints Table. You can't have continuous index_column values for each cells. By this I mean, that for every cell, your index column value should start from 0. When you have continuous value for the index column, hibernate assumes that for cell 2 you have 4 elements because the highest index is 3. (so 0,1,2,3), that's the reason you see length of cell.checkpoints as 4 in cell 2 and 6 in cell 3. So, you have to change your logic to get this at place. Last edited by hgadhia at
19:48 Mar 11, 2015.
|
lmann2
Posts: 156
|
Posted 20:15 Mar 11, 2015 |
Ah, totally and actually that solves a separate issue with reordering. Edit: here's a question, there's no setters/getters for ordercolumn. Can you control the sequence/number of ordercolumn for when you create a new entry? I didn't notice any option for this in: https://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html. Edit: I think this is working, but I still don't quite understand why, I think this is magic. Last edited by lmann2 at
20:45 Mar 11, 2015.
|
hgadhia
Posts: 52
|
Posted 22:50 Mar 11, 2015 |
The order column is automatically set for the list. Since, the List is an ordered collection, so the order of this list is taken as the column indexes. I guess you have no control to it, Hibernate controls it internally. |