Following is my code Here I am using multiple lists to fetch data from database. On fetching data from hql query it is showing exception.
Pojo Class
Changing to Set
is the best solution. However, if you cannot not replace the List
with Set
(like in my case, there was a heavy use of JSF tags specific to Lists
), and if you can use Hibernate proprietary annotations, you can specify @IndexColumn (name = "INDEX_COL")
. That solution worked better for me, changing to Set
would require tons of refactoring.
So, your code would be something like this:
@IndexColumn (name = "INDEX_COL")
private List<BillPaidDetails> billPaidDetailses = new ArrayList<BillPaidDetails>();
@IndexColumn (name = "INDEX_COL")
private List<BillProduct> billProductList = new ArrayList<BillProduct>();
As Igor suggested in the comments, you could also create proxy methods to return the lists. I haven't tried that, but would be a good alternative if you cannot use Hibernate proprietary annotations.