Most voted "hibernate" questions
Hibernate is a framework for object-relational mapping written in the Java language, but is also available in . Net as the name Nhibernate.
Learn more…934 questions
Sort by count of
-
5
votes1
answer2036
views@Enumerated(Enumtype.STRING) Hibernate JPA
I have the following field classificacao in a table. This field is filled in elsewhere and is filled with, only, 'P' or 'N', acronyms for Positive and Negative. I then created the enum Java.…
-
5
votes3
answers1175
viewsJPA + Wildfly + Hibernate
Is there any way to dynamically change the connection to the database by changing the file standalone.xml of Wildfly 8 (or 10)? Currently I have a class Hibernatesessionfactory that creates um…
-
5
votes2
answers239
viewsGET request is not answered correctly by backend
The project is an Angular 6 front-end, which connects to a Java back-end for communication with a SQL Server BD. The server that receives the file .war, containing both the back and the front, is…
-
5
votes1
answer44
viewsConfiguration of the Hibernate!
Hello I’m having a difficulty regarding a Hibernate configuration hibernate.hbm2ddl.import_files i believe q am doing everything right to find the sql path, I am using the same to insert some data…
-
5
votes1
answer221
viewsWhen is the standard model request/Answer required in the context of a REST application?
If possible, let’s imagine a context where Spring Boot and JPA are used. During the construction of some REST API, I always wonder if I should perform the standard model request/Response. For…
-
4
votes3
answers370
viewsHow to perform TDD using Hibernate
I would like to know how to perform TDD using Hibernate. I have been informed that this ORM stores memory before recording into possible, so I wanted to know how to test a data that is in memory.…
-
4
votes1
answer1449
viewsError inserting into Hibernate database
How do I insert the Product object into the database that is composed of an Ingredient object that already exists in the database, without duplicating the Ingredient object in the database. If I…
-
4
votes3
answers474
viewsMap java.time properties with Hibernate and/or JPA
Is there any way to map properties like java.time.LocalDate and/or java.time.Instant through JPA and/or Hibernate?
-
4
votes1
answer263
viewsIntegration between Spring and JPA
I recently started studying one of the most amazing frameworks I’ve ever known, Spring. I always make good progress in my studies, I’m already studying the integration of Spring with data access…
-
4
votes2
answers4196
viewsGet list of objects with JPA and Hibernate
I’d like some help. In my code the method of entering the object in the database is working, however when trying to get a list of objects stored in the database, I get the error that my table is not…
-
4
votes1
answer3184
viewsSize of a Java + Hibernate String
Is there any way to persist a string with no size limit for the bank using Hibernate? If I map my class and don’t limit the field, Hibernate automatically creates a limit of 255 characters. I could…
-
4
votes2
answers1101
viewsRemove association in relation to Many to Many
I have a relationship @manytomany unidirectional and need to remove this association according to some criteria but did not want to have to browse through all objects in the collection to remove…
-
4
votes2
answers949
viewsProblems with JPA - Hibernate does not persist WHOLE object
Good morning guys! I have the following entities: package br.com.sistema.entidade; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import…
-
4
votes1
answer306
viewsObject-relational mapping (JPA + Hibernate) using XML
For a specific reason, I need to do object-relational mapping (JPA) of my entities with XML. [Unfortunately,] I cannot use annotations to do this. It turns out that in certain properties, I need to…
-
4
votes2
answers538
viewsMaven project with Hibernate and Glassfish does not generate database
I have a Maven project and I’m having problems generating the database, I’m using Hibernate and Glassfish 4. No error is generated, just no data is generated, I’m new with Maven maybe I’m forgetting…
-
4
votes2
answers412
viewsProblem when changing the type of a column in the model using JPA annotation
I have a column in the database that is limited to receiving a varchar(255), but I need to change this to a bigger size. For that I added these annotations in the field: @Column(nullable = true,…
-
4
votes2
answers1316
viewsHow to Inhibit Display of Information on the Eclipse Console using Hibernate
I would like some help. I am developing a system using jpa-Ibernate, jsf and primefaces. Whenever I run the application the following appears on the console: 0 [http-8080-2] INFO…
-
4
votes1
answer423
viewsTry/catch does not "catch" to Exception
I’m using JPA and was trying to create an Entitymanager, and was testing some expcetions treatments in a class of mine. However, I have a problem, that Exception is not being "caught" by catch.…
-
4
votes1
answer721
viewsHibernate + Inheritance
I’ve been trying for some time a solution to my problem. I’ve done a lot of research but nothing clearly explains what I need. So I created an example application and am making it available from…
-
4
votes1
answer2596
viewsCreating Automatic Tables by Hibernate
Good afternoon, I am trying to create the tables automatically, and I think I must be missing something. someone can help me? this is my line of code Java office. package br.com.teste; import…
-
4
votes1
answer245
viewsData Truncation with Hibernate
Goodnight. I have a problem to persist an object, Hibernate throws an exception saying that the data are too long for the "street" column, type String. Follow Pojos and DAO. Address @Embeddable…
-
4
votes2
answers9897
viewsWhat is JPA’s mappedBy for?
Example: @OneToMany(mappedBy = "chemical", fetch = FetchType.LAZY) @LazyCollection(LazyCollectionOption.EXTRA) @JsonIgnore private List<SimulationChemicals> simulationChemicals; Why is the use…
-
4
votes2
answers798
viewsSyntax error when creating table in Postgresql using Hibernate
@Entity public class User { @Id @GeneratedValue private int id; private String name; private String email; private String sex; private int age; private Date birthday; private Date registerdate;…
-
4
votes1
answer824
viewsCreate Dto by Constructor with a List parameter of a Hibernate entity
I have a @Query Spring, which performs a database query by an Entity, to create some Objects DTO. And the properties of this DTO object, I pass via Constructor, but I needed to pass as parameter in…
-
4
votes1
answer893
viewsI cannot ignore fields when trying to return them as Json causing "Infinite recursion"
I’m working with Hibernate, Spring and Jackson (to ignore fields) and when trying to return the class User in a json request java returns error due to mapping @Onetomany and @Manytoone with class…
-
4
votes1
answer1560
viewsFetch of children with JPA+Hibernate not working
I have two classes, Terminal (who is the father) and Portaria (son). I’m using JPA and it’s working, but there’s a bug I can’t fix. I upload a list of Terminal and when testing the t.getPortarias()…
-
4
votes1
answer462
viewsHow to test the service layer
I’m developing a multi-layered, multi-module web project. For the persistence layer I am using JPA 2.1 and Hibernate 4.2 and for Junit 4 tests. In this architecture my project was divided into…
-
4
votes2
answers812
viewsPegar sql Hibernate
Good morning. I have the following problem, I need to take sql executed by Hibernate and save in a string. But I have no idea how to do that, someone could help?
-
4
votes1
answer1304
viewsHow to persist abstract class with JPA
I know JPA and I have other tables already implemented and working. I would like to know how to persist the classes below, since one is an abstract class and the other is "extending" it. I should…
-
4
votes1
answer1964
viewsImage upload with Primefaces on Tomcat server, only the image path being saved in the database
Fala galera. I’m a beginner in Java and am doing a small Dynamic Web project using Primefaces, JSP, Hibernate and Tomcat. Basically it is several forms of registration and one of them is the…
-
4
votes1
answer724
viewsHow to map entity with Hibernate to create non-unique constraints?
I’m trying to create an entity with the following mapping: @Entity @IdClass(AutenticacaoPK.class) public class Autenticacao { @Id @OneToOne(cascade = CascadeType.REFRESH) @JoinColumn(name =…
-
4
votes1
answer362
viewsUpdate the database correctly
Updated: Link with a video that better exemplifies the situation. I have a big problem, I’m having difficulties to update the database and display the updated data in 2 DataTables different. I have…
-
4
votes1
answer163
viewsError executing function for the second time
Inside the controller I have this function: public void salvaEncaminhamento() { Integer qtdEncaminhamento = 0; if (manifestacao.getTbEncaminhamentoCollection() != null) { qtdEncaminhamento =…
-
4
votes1
answer524
viewsHibernate is not creating or updating BD tables
I have the classes Beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"…
-
4
votes1
answer505
viewsJSF/Hibernate How do I save null to a database field?
I have an application using Primefaces/JPA-Hibernate/Tomcat8, and I need that when a field on the screen is empty, it will record null in the bank (Postgres). I need this because I have some fields…
-
4
votes1
answer84
viewsJPA does not reflect the changed data in the BD manually
I have a Javafx application with Hibernate (JPA). In this application I update a Tableview with the data I search from BD (Mysql). Every time I click for the system to search in the BD some data, it…
-
4
votes1
answer1187
viewsTomcat 8 + Mysql + Hibernate > Name [jdbc/toca_data] is not bound in this Context. Unable to find [jdbc]
I’m having serious problems with an application, I’m trying to set up and nothing. As I am beginner in the web part, I will say first what I understood: Tomcat needs settings (xml) to work with…
-
4
votes1
answer130
viewsDetached Exception in associative table
I am finding the following problem when making a certain registration: Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity…
-
4
votes1
answer131
viewsForeign key recording as null
Foreign key is writing as null. I have done several searches I could not find a solution. Could help me find my error. This is an example that I searched on the internet, if I can popular the…
-
4
votes2
answers3140
views -
4
votes2
answers1673
viewsHow to resolve this 'java.lang.Illegalargumentexception: Unknown Entity' when running this simple application?
I am new to the world of Hibernate and when I run this application, I get the following exception: java.lang.IllegalArgumentException: Unknown entity: com.nataniel.api.domain.User at…
-
4
votes1
answer171
viewsHow to map two equal entities with Hibernate
I have a scenario where I have the entities Pedido and Usuário. The Pedido is composed of some attributes, among them the requester that is mapped as follows: @ManyToOne(fetch = FetchType.EAGER)…
-
4
votes1
answer105
viewsLock optimistic; why not fire exception?
I tried to simulate an optimistic Lock situation where one tries to update the same record twice, but the excesses are not triggered. I find it interesting is that even after changing the value of…
-
4
votes1
answer405
viewsTesting Factory Hibernate
Is giving null Exception on line HibernateUtil.getFactory().openSession(); in the main method. Follow how are the configuration and test files: <?xml version='1.0' encoding='utf-8'?>…
-
4
votes1
answer48
viewsquery executes in the database but in the project points error
I have a query native: SELECT dist.nome Distrito, enti.nome Entidade, dist.id_distrito, dist.codigo_dne, dist.id_entidade, dist.id_municipio, dist.id_uf, dist.flag_ativo, muni.nome Municipio,…
-
4
votes1
answer193
viewsJPA ordered return from the Many side of an @Onetomany entity using @Orderby
I have the following entity Cliente who owns Pedidos. The relationship between customers and orders is mapped with Cliente @OneToMany and Pedidos @ManyToOne. What I need is for the Customer Order…
-
4
votes1
answer664
viewsCount with HQL JPA
Problem How do I receive the amount of record from a database table? public Integer quantidadeRegistros() { try { Query query = em.createQuery("SELECT COUNT(*) FROM Categoria cat"); return (Integer)…
-
3
votes1
answer1384
viewsError deploying to Wildfly
I’m getting an error trying to do deploy of my Wildfly 8 app: Caused by: org.jboss.as.server.Deployment.Deploymentunitprocessingexception: JBAS011445: Failed to get Adapter for persistence Provider…
-
3
votes2
answers599
viewsHow to make Hibernate "realize" that the value of a column was set by the database
My table in the database has a column that is automatically populated by the database itself. This table is mapped as an annotated class with @Entity, called EntidadeA. The column that is…
-
3
votes1
answer238
viewsHow to play query with Mysql queries in Hibernate?
I am using JPA 2.0 and trying to play this query in Hibernate , but I am not able to visualize how to do. I did it in Mysql language SELECT totalassociado, totalcriticado, items.item_codigo_item,…