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
-
3
votes1
answer384
views -
3
votes1
answer115
viewsProblems with Opensessioninviewer + JPA + Tomcat standard
Hello, I am using Tomcat + JPA + Vraptor 4 and I am using cdi to inject Entitymanager as follows. Entitymanagerfactorycreator: public class EntityManagerFactoryCreator { @ApplicationScoped @Produces…
-
3
votes1
answer374
viewsHibernate, force table name in low box
I am using Hibernate 5.2.1.Final as an implementation to handle Mysql database. The problem is that the tables are being generated with the first letter in high box, would like to force to be all in…
-
3
votes1
answer458
viewsorg.hibernate.Propertynotfoundexception: Could not find Setter for sum on class Class
People I’m trying to list the best selling products using Sqlquery (if anyone knows of other ways to perform as eg using Criteria, Projections also accepted) with Hibernate, but this error is…
-
3
votes1
answer107
views -
3
votes1
answer61
viewsHibernate Cache with select Count
Hello! I have a JPQL consultation, with count: public Long quantidadeFaturasAbertasAssinante(Integer idAssin){ return manager.createQuery("select count(f) from Fatura f where f.dataLiquidacao IS…
-
3
votes1
answer1778
viewsObject persisting problem with @Manytoone - JPA/Hibernate
I have the following problem: I can save/persist the two objects below, but JPA is not linking the ID of the DeclaracaoImportacao in the column ID class/entity . Follows code @Entity @Table (name =…
-
3
votes1
answer337
viewsHow to Call Values from Another Class
I am creating a vehicle control, and in it I have a register of Fuel that has description and value, and another record of Supplies. My supply record has a autoComplete of Fuel. The problem starts…
-
3
votes2
answers118
views -
3
votes3
answers377
viewsHibernate works OK, but does not finish the process
I don’t know if this is normal, but Hibernate starts the process, inserts the object into the database, but its java process is open. What I have to do to make this process automatically end after…
-
3
votes1
answer901
viewsHow do I make a left Join with criteria with an n-to-n table not mapped in java?
I tried to do it this way, but it’s coming back null in the query. Does anyone have any idea how I can solve this? public List<Pessoa> filtrar(Pessoa pessoa) { Session session =…
-
3
votes2
answers928
viewsClose entityManager after operations? How to manage?
I have been doing some courses and all the material I have read so far exemplifies the use of JPA/Hibernate in small examples, however, when we are developing something more concrete as a project,…
-
3
votes1
answer300
viewsObject is not updated
In my flow it’s like this: I already have an object stored in the database. When loading my page, these objects are searched in the database, treated to be displayed. Objects arrive in a List…
-
3
votes2
answers616
viewsRollback() JPA + Hibernate
I have a problem with persisting several information in the same transaction, in case something goes wrong a part of the information is recorded in the bank and the rollback() is not executed.…
-
3
votes2
answers287
viewsHow to avoid Lazyexceptions?
My application faces numerous Lazyexceptions problems and what causes a "mess" in the server log. I understand that they occur because the connection to the database has already been closed and I am…
-
3
votes1
answer78
viewsWhy is Hibernate deleting before saveOrUpdate()?
I have a m:n relationship between Column and Element. The entity that owns the relationship is Column. but when I’m saving a map of Columns, the following scenario happens: 1) In the first…
-
3
votes1
answer135
viewsQuery using Hibernate does not bring record
I’m trying to query the HSQLDB database using Hibernate but I’m not succeeding. When I do: session.get(Usuario.class, new Integer(1)); The query is made because it shows the query mounted by…
-
3
votes1
answer97
viewsObject getting null in the middle of the process
I am developing a system using Java, Maven, Hibernate, Primefaces and Mysql database. Within this system, I have created a program to record the amount of rainfall that occurs on the day. My table…
-
3
votes2
answers115
viewsSearch information in the database with validation of Hibernate parameters
Analyze the following situation: will come in request the information of the country that can be {0, 1, 2}. The replacement method will look like this: Nomenclature of the country parameter: 0:…
-
3
votes1
answer145
viewsEntities marked as FETCH LAZY are returning "null" even after a call to the GET method
Hello, good morning friends, Why my entities marked as fetch Lazy are returning "null" even when they are invoked through a get? What I learned in several courses is that when making the first call…
-
3
votes1
answer46
viewsForeign key is not printed in table
I have an entity that has the Onetoone relationship with another, but the foreign key of the other entity is not being printed in the table, the field is empty Entity having the Onetoone…
-
3
votes1
answer156
viewsHow to manipulate several banks with Hibernate?
I am testing the functioning of Hibernate and I came across a question. I have the following configuration: Hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE…
-
3
votes1
answer378
viewsJPA Deletes database data each time it restarts
Every time I restart the service, the data is deleted from the database. Has anyone gone through this and can you help? I am using Spring boot with JPA, Hibernate, Mysql, WEB and Rest. One of my…
-
3
votes2
answers598
viewsError in @Onetomany mapping with JPA and Hibernate
At the moment, I’m having a problem with mapping @OneToMany/@ManyToOne in my application. I would like it when I persist my entity Sale automatically save the sale items in single shot. @Entity…
-
3
votes1
answer110
viewsIs it correct to use @Mappedsuperclass instead of @Entity to not create a table in the database using JPA?
Explaining the problem, I need to consult a function in POSTGRES: SELECT * from pgr_dijkstra('SELECT gid AS id, source, target, length AS cost FROM ways', 11111, 22222); "pgr_dijkstra" is a POSTGIS…
-
2
votes1
answer317
views -
2
votes2
answers1399
viewsConfigure Hibernate transactions only with Jersey API Annotations
I want to use something similar to org.springframework.transaction.annotation.Transactional Spring that configures a Transaction only using only the Jersey API. Something similar to the code that…
-
2
votes1
answer195
viewsLimit set size<> with JPA
I’m having a hard time searching Google and I can’t find a solution. I have a note in JPA with a set<> I want to limit the size of objects inside the set, that is, the code below:…
-
2
votes1
answer148
viewsSoftware to query’s JPA
Is there a client (like: pgadmin3, Oracle SQL Developer, Mysql Workbench) for JPQL queries? I have a jpa project, and I need to debug the generated jpql’s. I saw that Squirrel does it, but for HQL.…
-
2
votes1
answer792
viewsHow do Hibernate Search sort the result of a search?
I have a indexed search with the Hibernate Search but I can’t get Hibernate Search order the search result in the order of a given column, as for example the name column. But there is a peculiarity.…
-
2
votes1
answer8935
viewsProblem persisting: "Cannot add or update a Child Row: a Foreign key Constraint fails..."
Tables Contact CREATE TABLE IF NOT EXISTS `sgct-database1`.`contato` ( `contato_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `telefone` CHAR(10) NOT NULL, `celular` CHAR(11) NULL, PRIMARY KEY…
-
2
votes1
answer1097
viewsHibernate: Error while trying to persist field that maps foreign key
In my current Spring project, I am facing the following problems when trying to save one entity that refers to another (with foreign key), with this: @Entity @Table(name="pagina") public class…
-
2
votes1
answer673
viewsTrouble creating entity with Hibernate/JPA
Good afternoon guys, a little while ago I came across a problem in which I can’t find the solution. This is the following: I have 2 classes in the database created through annotations using JPA.…
-
2
votes1
answer63
viewsClass relationship by collections in JPA2
In a bean that has a Onetomany connection, with others, through a Hashmap that annotations should be used?. @Entity class Rodada{ public HashMap<Pergunta,Resposta> perguntas;…
-
2
votes1
answer275
viewsHibernate Boot
You can disable the check that Hibernate does every time the app starts? That is, at the time I create the table classes and I create the columns, it is normal that the first time the app runs…
-
2
votes1
answer708
viewsHow to store date/time of change in BD using Hibernate Envers?
I need to keep a log of all transactions of an entity with Hibernate Envers. I set persistence.xml as below: <!-- Configurações do Envers --> <property…
-
2
votes2
answers290
viewsRecovering List of Outdated Objects with Hibernate
When I manually insert an object in Mysql via terminal, Hibernate does not recover the list with the updated object, it is always the same as the last query, as if it were taken from some cache. I…
-
2
votes1
answer291
viewsProblem with table extension in Postgresql, Person and Physical Person
I’m making an application that has a register of people, is a CRUD of Person that can be both physical and legal. the problem is that in my design should be created in the database a Pessoa and a…
-
2
votes1
answer365
viewsCollection Namedquery as Parameter
I am using the Namedquery of JPA, to create a DTO. And in my Query I have as condition one IN and as a parameter of IN has values with white spaces in the middle. (Ex: 9292 929). and these values…
-
2
votes1
answer2941
viewsHow to do custom query with JPA+Hibernate
Hello, I would like to know an elegant way to make a custom consultation using JPA. Basically I want to run the query and that it return me an object list, but usually it will be a query with N…
-
2
votes1
answer1217
viewsSpring Bean sessionFactory with Nullpointerexception error
Good morning. I am trying to make a configuration in the spring-jpa.xml file to support a multitenancy architecture separating each client by Schema. I use a datasource that has been configured in…
hibernate spring jpa-2.0 wildfly multi-tenancyasked 9 years, 9 months ago Giancarlo Abel Giulian 3,999 -
2
votes1
answer441
viewsGet list of JPA/Hibernate Persisted objects
Hello, how do I get the list of persisted objects before committing it in BD. Follow the example below: Pessoa p = new Pessoa("Joao", 21); Pessoa p2 = new Pessoa("Pedro", 17); Pessoa p3 = new…
-
2
votes1
answer1372
viewsUpdate column and table settings with Hibernate
Good afternoon. I would like to know and confirm if you have any way to update table and column definitions in each schema using Hibernate. For now, what I’ve seen so far is that Hibernate only…
-
2
votes1
answer402
viewsStackoverflowerror exception occurring in @Manytomany relationship with JPA
I’m having a problem in an entity relationship @Manytomany. When I try to make a simple query in the entity that contains @Manytomany a stackoverflow occurs. My rule is simple: My…
-
2
votes1
answer134
viewsConfigure Relational and Non-relational Databases in the same project with Spring-Data + Hibernate
I am trying to create a Java application where I need to configure two databases: Mongodb and Mysql. My idea is to use Spring-Data with Hibernate for both banks, but I found only tutorials for…
-
2
votes1
answer1508
viewsJpa with Hibernate implementation does not generate postgresql tables
Good evening to all I am using Jpa with the implementation Hibernate to among other features generate tables, the problem is that from one hour to another the tables stopped being generated, someone…
-
2
votes2
answers1726
viewsexclusion of a database object with jpa 2 and jsf 2
Well I’m trying to do a jpa deletion using jsf but I’m not succeeding. have my table. <p:dataTable value="#{mbProduto.produtos}" var="produtos" paginator="true" rows="10"…
-
2
votes1
answer194
viewsList coming with null value
Well, the thing is, I have three methods that are called init() of my Bean, only one works and the other 2 comes as null, I’ve already debugged and in my Product the data is correct, but when I…
-
2
votes1
answer1965
viewsUpdate form dialog without closing it
How can I update my form dialog without closing the same? In other words, I need to search the address by the zip code, and throw it in the form, but I’m not getting it. Follow the code I’m using.:…
-
2
votes1
answer947
views(Hibernate2) Genericjdbcexception: Could not execute query - Closed session error while browsing the platform
Good afternoon! I have a web application and decided to migrate it to Cloud Google. When I start my Cat, the application runs smoothly, but from a certain time, starts to appear these errors.…