Click here to Skip to main content
15,886,067 members
Everything / Hibernate

Hibernate

Hibernate

Great Reads

by Han Bo Sun
Detailed description of how many-to-many association works with Hibernate, using MySQL and Spring
by Dr. Song Li
This is a note on Spring Boot and Hibernate
by Grzegorz @ tidyjava.com
Are you using frameworks the right way? Are you using frameworks for business purposes or the other way around? Are your business classes dependent on frameworks?
by Edwig Huisman
A hibernate framework for C++

Latest Articles

by Edwig Huisman
A hibernate framework for C++
by Dr. Song Li
This is a note on Spring Boot and Hibernate
by Grzegorz @ tidyjava.com
Are you using frameworks the right way? Are you using frameworks for business purposes or the other way around? Are your business classes dependent on frameworks?
by Han Bo Sun
Detailed description of how many-to-many association works with Hibernate, using MySQL and Spring

All Articles

Sort by Score

Hibernate 

4 Jan 2016 by Han Bo Sun
Detailed description of how many-to-many association works with Hibernate, using MySQL and Spring
3 Sep 2020 by Jörgen Andersson
Your Client class has Five fields, including one names "id" But your query has only two fields "Fullname" and "City". The first column missing in your query is "id". Make sure the class and query match.
17 Feb 2018 by ThilinaMD
try this code int pageNo = 1; if (request.getParameter("pageNo") != null) { pageNo = Integer.parseInt(request.getParameter("pageNo")); } instead of int pageNo=Integer.parseInt(request.getParameter("pageNo")); Error is caused due to at first when your servlet load there is no value for...
10 May 2018 by Wendelius
Hibernate is an ORM, Object-relational mapping tool which simplifies using the database in a Java application. See Object-relational mapping - Wikipedia[^] and Hibernate (framework) - Wikipedia[^]. What comes to integrating to other frameworks, in general I would say so since the connection...
7 Dec 2021 by Afzaal Ahmad Zeeshan
Quote: create relationships between entities in a project that is being written from scratch, or specify what relationships to have between them? That's the best part about an ORM. You don't need to think about it yourself (apart from some index,...
29 Dec 2021 by OriginalGriff
Unless your table includes a "InsertedBy" column that identifies the user when the INSERT operation is made, it's complicated, and will depend on the database system and the way it is used by you. If it's a multiuser DB system like SQL Server or...
18 Dec 2017 by Dr. Song Li
This is a note on Spring Boot and Hibernate
3 Nov 2014 by Ashraff Ali Wahab
We have a use case where the user can submit 1000 payment transactions(of course in corporate banking this is possible) from a UI.We all know it is impossible to submit all 1000 from the UI all at once. So we have a pagination logic built in the UI where user can save 200 at once. After...
23 Nov 2014 by Sallerio
I need to see some related codes on this so that i can start working on it. Can anybody help me out pliz?
23 Nov 2014 by Sallerio
Select * from table_name where country_code='IN';Database has so many datas with different country code.For example:IN(India),GB(Great Britain),US(United State) etc.
24 Nov 2014 by Richard MacCutchan
There are many samples and tutorials to be found on Java, jQuery, database in general, and nHibernate, if you do a few Google searches.
25 Nov 2014 by Darshana Dinushal
Try this...Criteria cr = session.createCriteria(Country.class);cr.add(Restrictions.eq("code", 'IN'));List results = cr.list();
4 Feb 2015 by Member 11426328
suppose i have a pojo like@Entity@Table(name = "college", catalog = "practice")public class College implements java.io.Serializable{ private int id; private String name; private String caddress; private String ccode;}and getters and settersNow i want...
4 Feb 2015 by Pravin S K
we can take an alternate approach for that first we will fetch the result in to map and then covert to pojo by using jackson api for exampleSQLQuery query = session.createSQLQuery("select id,name from College"); query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);...
19 Feb 2015 by Member 11465821
Hibernate we are using many to many mapping and Criteria Api.SO i want to appy hibernate join with many to many mapping. and also i dont have lots of idea about many to many. So plesae guide me..
16 May 2015 by Member 11695401
in case of hibernate how we can use use session to existing session object?anybudy pl let me tell?
17 May 2015 by Bùi Long Nghĩa
Database:table:-books (bookId, bookName, author, publisher, publishingYear, price, quantity, CateId, bookClassId)-bookclass (bookClassId, bookclassName)-categories (cateId, cateName)Spring - Controller @Controllerpublic class ControllerBook { IBookDaoImpl book; ...
27 May 2015 by Member 11524654
Hello , I have a problem which i cant solve.I searched all around google and found nothing good here...Im trying to make relation beetwen two classes : Client(one-to-many) - Account(many-to-one)but i get an exception : org.hibernate.MappingException: Association references unmapped class:...
28 May 2015 by Shubhashish_Mandal
For "class" attribute use full class name along with package name instead of the class name. i.e use this instead of
6 Jun 2015 by Member 11524654
Hello ,I try to make a web application but i have some problem with my databse and mapping.I used Hibernate Annotation(used field),and made 3 tables (it will be a quiz game) one for the Category's(contains an id and a name) one for the Questions(contains an id aka pk and a foreign key from...
11 Jun 2015 by mayooran99
I am new to spring and hibernate. I have created a spring-mvc app with hibernate integration and when I run the code I get the below given error. My requirement is to pick the relevant path from the advertisement given the customer category. This involves two tables respectively along with the...
13 Aug 2015 by JavaDeep
I've a list of values to be passed from my controller to the jsp page. I've the below controller:@RequestMapping(value="/addClient.do", method = RequestMethod.GET)protected ModelAndView Submit(HttpServletRequest request, HttpServletResponse response) throws Exception { MyForm = new...
9 Feb 2022 by Member 12106197
The problem is hard to explain, so please have a look at the project: https://github.com/darzz/boot_bug This is the minimal setup, that reproduces the bug.Description: The application stack is Spring Boot with Spring Data and Spring Batch. There is testNamedQuery.hbm.xml file under...
13 Jan 2016 by mihaib27
I am trying to run a Spring application with Apache Tomcat and I get the following exception in the server log:[Apache Log] org.springframework.beans.factory.BeanCreationException: Error creating bean wi - Pastebin.com[^]In the log it says at the end that it is caused by entity Assignment...
13 Jan 2016 by Member 11406049
I think the problem is while injecting. you can see in log Error creating bean with name 'assignmentController': Injection of autowired dependencies failed;may be you are trying to injecting service class to controller class there you are getting a problem, problem is not in DAO class see...
14 Jan 2016 by Member 11211778
I am trying to paginate rows of a table inside my servlet using hibernate.But once I click on the desire index of the page it always gives me only the first set of row of the table.My servlet code:int pageIndex = 0;int totalNumberOfRecords = 0;int numberOfRecordsPerPage =...
16 Feb 2016 by F-ES Sitecore
Use Entity Framework, it's the evolution of Linq2Sql, and nhibernate is just your typical badly-documented non-Microsoft technology.
16 Feb 2016 by johnwalker10
Hibernate, because it's the defacto standard in Java and was one of the driving forces in the creation of the JPA. It's got excellent support in Spring and dictates the standards in the ORM field. You can translate a very complex object model into a relational model and almost every Java...
2 Mar 2016 by tarsus04
Hi,I would like to know how to get the power policy (or power scheme) values of the current energy plan set by an user in Windows, such as minutes left to sleep (S3) and minutes left to hibernate (S4).How could I get the real values given by the user for a power policy scheme?Im...
8 Jul 2016 by Ru_Ru
I have an issue validating a nested object. What I mean by this is that I have a registration form, where a command object is provided that looks like thisshort version:public class RegistrationObject { private User user; @NotEmpty @Size(min = 5, message =...
20 Jul 2016 by Jignesh Khatri
I am going to develop which will be web application as well as mobile (android / iOS / windows) application. The database in this application will be managed by Hibernate. Also as it is cross platform application, web service will also be used. What I know so far is:HIBERNATE:*) POJO Files...
21 Jul 2016 by rah_sin
Have you tried google itSpring 4 Restful Web Services With Hibernate 4 Example using Maven – Server Application | Beingjavaguys.com[^]
17 Sep 2016 by xoone
what does it mean to develop a hibernate framework depiction in bank management system using file handling in java? The usage of hibernate is directly associated with underlying files carrying the objects information. When a database query is executed i.e. insert, delete, update and search,...
18 Sep 2016 by john1990_1
I tried moving the mouse programmatically but this didn't stop the "away from PC" because the user didn't do the move instead of the keypress that may be problematic.What I have tried:I simulate a keypress for Ctrl but I want to move the mouse 1 pixel to the right and then one pixel to...
18 Sep 2016 by harish85
You can use SetThreadExecutionState with ES_SYSTEM_REQUIREDNote: its a native method.More details regarding Sleep criteria from msdn linkSystem Sleep Criteria (Windows)[^]
13 Nov 2016 by Member 12824529
The following general solution will find rows in table x that are not linked in table y. It makes use of Except in SQL, to accomplish what you are trying to do. Hope this helps.var linked = from x in dc.X from y in dc.Y where x.MyProperty == y.MyProperty select x;var...
23 Dec 2016 by Member 12768835
I'm using XML mapping. I tried to make a many to many association between Invoice and Product (an invoice can contain many products and a product can belong to many invoices). My approach was to make an association called "InvoiceLine" that will contain a single product, its quantity and total...
6 Feb 2017 by vishal.v.patil
Error spring application.. the project working smoothly but on deployment it will giving below error here i am using java 6 and tomcat 6SEVERE: Exception sending context initialized event to listener instance of class...
6 Feb 2017 by praveenlob7
Hi,Compare your local tomcat server.xml and hosted tomcat server.xml for config changes.
30 May 2017 by Member 13230318
I want to read csv which column length will not fixed client can provide multiple/single csv with diffrent column data to complete single object(java). suppose one file contain only names and other can have age or other details but i have to make single object of person and insert into table. ...
30 May 2017 by S Houghtelin
You can have several .csv files with differing lengths, however, there needs to be a way to create a relationship between the files. What you are describing is a simple database, think of each .csv file as a table. How databases make relationships to other tables is through the use of keys....
7 Jul 2017 by Member 13172795
I am using Hibernate to create table in mySql database. I have two table "conge" and "employee" and I have a manytoone relationship. the "conge" table have a foreign key of the employee id. this is my error Cannot add or update a child row: a foreign key constraint fails (concretepage.Conge,...
27 Jul 2017 by Annu Ranjan
I have a variable of type Boolean in my entity class by name "isActive". It to mapped to a column by name "is_active" with data type as bit. @Column(name = "is_active") private boolean isActive; But when ever I try to save isActive attribute of the object, I get an error: column "is_active"...
27 Jul 2017 by RickZeeland
I think in NHibernate the column type is TrueFalse, which expects 'T' or 'F'. You would need to change the column type to Boolean. See: Chapter 5. Basic O/R Mapping[^]
22 Oct 2017 by Member 13479715
Hello, I'm completely new to Hibernate in java. I'm trying to access database but I'm getting this error. Please help me figure. Would greatly appreciate your help. This is what I have tried from the class where I'm trying to access. What I have tried: import org.hibernate.Session; import...
25 Oct 2017 by rakshapyo
I am not able to get the sorted table from the data base,where as the hbm.xml changes are reflecting only to print the console hibernate query but not resulting anything in UI What I have tried: headerDTO---->
11 Nov 2017 by VISH_a_CODE
Hello friends, I just got a question about commit() and rollback() methods used by Transaction class. But in Session class there are save() and update() methods. Why commit() and rollback() method not declared with save() and update() method in Session class and declared in Transaction...
11 Nov 2017 by Mehdi Gholam
You can "save" something with or without it being in a transaction, the session.beginTransaction() just indicates that the following (block of code) must all work completely or be rolled back if failed, so there are no side effects.
15 Nov 2017 by Member 13467536
here is my jsp Page code,in this page i try to call signUp.java which i have defined in Users package,and i have test this class in src FileFolder so that means it can run on java application without any problems
2 Dec 2017 by Member 13554024
in hibernate,i have tried a extract a collection object but bean class throw a error .Using collection object, what can we are create database table ? What I have tried: in hibernate,i have tried a extract a collection object but bean class throw a error .Using collection object, what can we...
17 Feb 2018 by Member 13681858
@WebServlet("/PagenationServle...
1 Mar 2018 by CHill60
Completely off-topic for this forum, and incredibly lazy on your part. Here is your quick answer LMGTFY[^]
16 Apr 2018 by Member 13783074
I have a table with columns as rows. Now I want to apply restriction on multiple rows with "and" condition.how can we do this using hibernate criteria? Example :Employee table Pk ColumnName. Value 1. Empid. 10 1 EmpName. Sachin 1. Empsalary. ...
16 Apr 2018 by Wendelius
You can use Restrictions (Hibernate API Documentation)[^] calling And method to define multiple conditions having AND.
16 Apr 2018 by Member 13783412
We have a standalone application on embedded win 7 which uses HORM concept and ewf ram reg mode. The server is on vxworks and both are connected via an ethernet port. Communication is set up using sockets. At the start of the application we get a customised error , which happens if the first...
10 Jun 2018 by Member 13700491
hibernate.cfg.xml
23 Sep 2018 by Member 13994629
Error: Could not find or load main class com.raj.spring.springormagain.Test What I have tried: Test.java package com.raj.spring.springormagain; public class Test { public static void main(String[] args) { System.out.println("hello world"); } } POM.xml
6 Jan 2019 by OriginalGriff
How do you expect us to be able to sort that out for you? You need to look to your hosting service for analytics and find out what is going on while your site is being used - we can't do that because we don't have any access: heck we don't even know what URL your site is on, much less what it...
6 Jan 2019 by Richard MacCutchan
This is an impossible question to answer. You need to gather more information from your system. [edit] Reposting the same question is not going to change the answer. [/edit]
6 Jan 2019 by OriginalGriff
When you asked this question an hour ago: Maximum cpu utilization[^] I told you we can't help you. That hasn't changed, even if you wish it had ...
6 Jan 2019 by Patrice T
Reposting same unanswerable question half an hour later will not improve answers. Maximum cpu utilization[^] The host admin is probably the only one able to give you useful hints.
14 Mar 2019 by Rajesh k bhushan
I have two table one is Credit and second is Debit. I want @OneToMany relationship. in credit table only single row of data and In debit table multiple row of data Credit table: cid openingBalance date debittotal drawertotal debittotalplusdrawertotal todaybusiness all row of only single row...
3 Aug 2019 by leoiser
Hi, I am new to springboot. I created an API which run some process that takes around one hour and return the result. The problem is if I submit two process parallel, I am getting the same output. Pls check the below code and give me suggestions Looks like ProcessService working on a same...
4 Aug 2019 by Richard MacCutchan
This is the same as the question you posted yesterday at https://www.codeproject.com/Questions/5163867/Springboot-API-returns-overlapping-results-for-par[^]. Please do not repost.
26 Oct 2019 by RickZeeland
See answer here: hibernate - why do I get Path expected for join when I use join key word in hql - Stack Overflow[^]
4 Jan 2020 by Member 14707219
I have a Q&A section where each question and answer has a user profile card associated with it. Which displays username, points etc. Data that makes up this user profile card is spread across multiple tables. I am fetching one or two columns from each of these tables. Now I am not sure what...
4 Jan 2020 by Christian Graus
The id of the user should go against the question or answer, that seems obvious. If you need data across many tables to display this, create views
15 Jan 2020 by Gerry Schmitz
Compare field lengths. The contents don't matter since the strings being compared are different length and the problem domain is known / limited.
1 Feb 2020 by phil.o
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FTS, Hospitalityexpense, Krishi_KalyanExpenses, manpowerExpensesContract, Manpow' at line 1 You made a mistake while building your SQL query. And despite...
15 Sep 2020 by Kasthuri Gunabalasingam
I have a table in DB as below.It accessing through JAVA(JPA) I have a table in DB as below.It accessing through JAVA(JPA) ID | Name | Parent_id 1 | Ann | NULL 2 | Mary | 1 3 | John | 2 4 | Joshep| 2 5 | Peter | NULL 6 |...
15 Sep 2020 by Gerry Schmitz
This is what MS says about it: Quote: This executeUpdate method is specified by the executeUpdate method in the java.sql.Statement interface. If executing a stored procedure results in an update count that is greater than one, or that generates...
23 Sep 2020 by Member 14639038
i am develoong spring web mvc application. when i execute the page: the following exception occurs: javax.servlet.jsp.JspException: Type [java.lang.String] is not valid for option items here's the code: home.jsp ----------
28 Jan 2021 by Akash Tetme
Hello, I'm new to thymeleaf. I've two entities, Patient Doctor which have one-to-many relationship between them, when I tried to set one Doctor to Patient, its showing null. I'm sharing my entities and controller here. please give advice. ...
18 Feb 2021 by Swapnil722
I'm selecting max id of Dosage entity after join Farmers entity: cq.select(cb.max(root.get("id"))) .where(cb.equal(root.join("farmers").get("id"), id)); It doesn't return uniqueResult(); but all Farmers instead. What I have tried: ...
15 Mar 2021 by Swapnil722
when I run Hibernate mapping files and POJOs wizard in NetBeans IDE 11.0.3 It doesn't create mapping files user.hbm.xml or POJO class for table user. What I have tried: hibernate.cfg.xml ...
29 Aug 2021 by SHYKAT ROY
Basically, I am trying to establish a relationship between my two tables using spring boots. And the relationship which I had used was the @onetoone and @onetomany relationship. But after building the relationship and creating the table in MySQL...
7 Dec 2021 by Member 15435322
I was wondering, what is the best way to create relationships between entities in a project that is being written from scratch, or specify what relationships to have between them? For example, as we can directly understand the relationship...
30 Jan 2022 by salam_verdim_alana_panyatkasi_olana
I have to Entity and relationship type between them ManyToMany. @SuppressWarnings("JpaDataSourceORMInspection") @Data @Entity public class Student { @Id private Long id; private Integer anotherId; @ToString.Exclude ...
9 Feb 2022 by Member 15529625
If you use maven, perhaps you could add a copy-resources plugin to copy the hbm files to the test-classes folder. maven-resources-plugin 3.2.0 ...
25 Oct 2022 by Mohit Tomar
I'm new to Spring Boot and still learning concepts such as JPA and Hibernate. I was practicing CRUD operations and got an error that totally confused me. I have a project with 4 entities, Admin, Customer, Product, and Saleorder. There is an one...
25 Oct 2022 by Richard MacCutchan
I would suggest going to https://www.baeldung.com/learn-jpa-hibernate[^] for some good learning resources.
7 Feb 2023 by Member 15916804
The car class will be inherited by several others, it needs to filter all attributes and method results. Can someone give me a hint how to do this? @Setter @NoArgsConstructor @AllArgsConstructor @Table(name = "APP_CAR") @Entity public abstract...
29 Nov 2023 by Andre Oosthuizen
The first thing to check is to make sure that your 'Order' entity is properly mapped in your database, and there are no existing entries with duplicate ID's that might clash with each other. The issue might also be because your 'order_id' is not...
18 Mar 2023 by Swapnil722
I want to select all distinct records not a specific one and as entities. I'm using Hibernate 5.6.15, JPA 2.2 and JDK 11 LTS I tried to select transid as an Orders' entity but getting: Caused by: java.lang.ClassCastException: class...
13 Jan 2024 by Swapnil722
Here's the answer : public List custOrder() { try ( Session session = HibernateUtil.getSessionFactory().openSession()) { CriteriaBuilder cb = session.getCriteriaBuilder(); CriteriaQuery cq =...
31 Mar 2016 by Grzegorz @ tidyjava.com
Are you using frameworks the right way? Are you using frameworks for business purposes or the other way around? Are your business classes dependent on frameworks?
25 Sep 2019 by Edwig Huisman
17 Sep 2016 by David_Wimbley
Your description makes no sense. I think what you've been given is a very vague and crappy explanation of using Hibernate in your Java bank management app.I encourage you to use google and research what it is you need to do with Hibernate in your app.Hibernate ORM - Hibernate...
3 Sep 2020 by Swapnil722
I'm getting: ERROR: column 'id' not found while using session.createNativeQuery() in hibernate 5.4.14 What I have tried: try (Session session = sessionFactory.openSession()) { var clients = session.createNativeQuery("select c.fullname,...
16 Feb 2016 by AbdelrhmanRaafat
I want to use one of the 3 ORM options (NHibernate, EntityFramework and LinqToSql) in my application which one is the better? and what is the advantages of it over than others?
1 Feb 2020 by Member 14639038
rfms_excel.java-> package com.rfmsProject.upload; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.Iterator; import javax.servlet.RequestDispatcher; import...
28 Mar 2015 by Member 10419621
I 'm trying to make a crud in Strud2 with hibernate and I can not combine two tables. Can you help meTable 1 is Trama@Entity@Table(name="trama", catalog="bd_1")public class Trama implements java.io.Serializable { private int traNoca; //Int private int catNoca; ...
18 Jun 2015 by Avinash6474
Hi All, 1) Created an application in Eclipse IDE with Java,Struts2 and Hibernate 2) Application is pointing to SAP HANA Database3) When executing an application in Eclipse IDE , able to see index page which receives input. 4) After entering required data, submitting the page. 5)...
16 Dec 2015 by Member 12211340
I'm new in Java EE (J2EE) , i would like to build web application that store users and passwords in databases than they can login and login out , after that i want let them can add , delete and edit fields like in this pic: table Edit...
13 Nov 2016 by Member 12167868
I have a team and in that I have a team members ... In my other module if I want to add other members in my team then I select the department and it will show all the members of that department ... But the problem is I want to show only those members of that department who is not in that team...
28 Mar 2018 by Asyraf Patt
How should i store the data into the object and calling it by using the hashmap ? means is : how should i get the data JPA extraction and call it at mymethod class ? ListCustomer.put(Long.valueOf(1), new Customer("","","","")); What I have tried: SelectCustomer private int...
10 May 2018 by DavidCorbin_1978
What are the benefits of using Hibernate Framework? Is it easy to integrate with other Java frameworks? What I have tried: Already read at codeproject some articles about it.
31 Jul 2018 by Mohibur Rashid
Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not parse configuration: hibernate-annotation.cfg.xml This is the error I am getting. Application runs properly all the time except for 2 incidents when application was throwing this error. My primary guess is...
31 Jul 2018 by Mohibur Rashid
After searching on google on the right topic, I found the solution in for DTD file. Using local file will solve the problem. And hibernate-core has a dtd file. So the solution is