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
Tag: hibernate
Include field name inside error message using Hibernate Validator
I’m using Hibernate Validator 4.2.0.Final and I’m looking for the simplest way to include class field name in my error message. What I found is the following thread Using a custom ResourceBundle with Hibernate Validator. According to this I should create my custom annotation for each constraint annotation adding one property to each one. Is there a cleaner way to
HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
Im getting this error: HTTP Status 405 – Request method ‘POST’ not supported What I am trying to do is make a form with a drop down box that get populated based on the other value selected in another drop down box. For example when I select a name in the customerName box the onChange function in the .jsp page
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
What is the primary key of an audit table managed by Hibernate Envers?
I am using Hibernate Envers to audit some entities. I manually created the associated audit tables. However, I am having trouble determining what an audit table’s primary key should be. For example, consider a fictional table designed to store customers: And you create the audit table: Here were the options I considered: Primary key: REVISION_ID This cannot be the primary
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 error – QuerySyntaxException: users is not mapped [from users]
I’m trying to get a list of all the users from “users” table and I get the following error: This is the code I wrote to add/get users: Adding users works, but when I use the getUsers function I get these error. This is my hibernate config file: and this is my User class: Any idea why I get this
How to deep copy a Hibernate entity while using a newly generated entity identifier
I’m using a relational DB using a single column pk with a few nested tables. I need to add a simple archiving to my project. The archiving only happens when the application reaches a particular state, so what I was hoping to do was copy my existing hibernate object into a new instance where the new instance would be saved
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