Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hibernate - Postgres- target lists can have at most 1664 entries

We are using hibernate, postgres 8.3x

Our entities are many to one mapped with eager fetching. We have multiple associations with Many to one mapping.

As we added new columns to any other existing entities, We are getting below error:

target lists can have at most 1664 entries

I searched internet and they say this is due to More number of select statements in sql query (generated by hibernate)

Can you any body please let us know if there is any configuration (in postgres) to update max number columns in configuration or any other solution to solve this issue.

Thank you in advance.

like image 926
Kumar D Avatar asked Mar 10 '10 15:03

Kumar D


4 Answers

Sometimes this happen when there are too much @ManyToOne(fetch=FetchType.EAGER) in the project. So, when is not necessary the FetchType.EAGER, put @ManyToOne(fetch=FetchType.LAZY)

This help me, try!

like image 100
Attilius743 Avatar answered Oct 26 '22 00:10

Attilius743


This is the max number of columns in PostgreSQL, that's correct. But why do you need even more columns? Just do some normalization and your problem is gone. Or don't use a relational database at all, you will always hit the max number of columns when you don't normalize.

like image 45
Frank Heikens Avatar answered Oct 16 '22 06:10

Frank Heikens


There is definitely something wrong with your model/mappings/query. The right way to fix that is to work on your model/mappings/query, not on the max number of columns in PostgreSQL (I don't even get how you reached it, a query that retrieve 1664+ columns doesn't make any sense).

like image 2
Pascal Thivent Avatar answered Oct 26 '22 02:10

Pascal Thivent


Try

      <property name="hibernate.max_fetch_depth" value="25"/>
like image 1
Martin Avatar answered Oct 26 '22 01:10

Martin