Skip to content
Advertisement

Tag: hibernate

How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?

I’m getting a warning in the Server log “firstResult/maxResults specified with collection fetch; applying in memory!”. However everything working fine. But I don’t want this warning. My code is My query is Answer Reason for this warning is that when fetch join is used, order in result sets is defined only by ID of selected entity (and not by join

Draw an ERD from Hibernate Mapping Files

I know it’s possible to reverse engineer from the database into mapping files but does anyone know if it’s possible to get hibernate to draw an ERD based on its own mapping files so that I can compare Hibernate’s ERD with the Databases one? Answer I achieved this by using: in my hibernate.cfg.xml Then I used MySQL Workbench to reverse

JPA: how to map SQL Server uniqueidentifier type

I’ve inherited a SQL Server database that I’m trying to map via JPA. Many of the tables have a uniqueidentifier column. I’m trying to map them like so: Hibernate complains with: Answer The data type of the primary key property in the POJO determines the data type of its mapped DB column, which is specified by the Dialect class. According

Negate unary operator in Hibernate QL

I’m trying to switch boolean field using the following hql: Unfortunately “QuerySyntaxException: unexpected token: not near…” was thrown. My question is: is there some unary operator for hibernate that supports such expression? Or any well known trick? sql supports such queries (postgresql): Answer I would just use a native SQL query for this.

Hibernate / JPA many to many relationship through a join table and a composite key, Unique Constraint issue

So I asked this question yesterday, but the goal posts have changed and the question is different: Hibernate / JPA Collection of Elements with Many to Many relationship? I want to know if it’s possible to create entities that will model my required relationship so that Hibernate will create my schema when I fire up my application. The relationship I

Advertisement