Questions tagged [hibernate]

Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.

0
votes
1answer
24 views

nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection [duplicate]

I have an application that is not working on windows. But it is working fine on linux(Ubuntu) with absolutely the same code. MySQL is throwing an exception and I could not figure out how to solve it. ...
1
vote
1answer
21 views

Get data using spring repository when relation one to many

So I have two classes Movie and Genres in relation one-to-many. What I want to do is to get List of Movies filtred by Genres name using Spring repositorys. I want to be able to do something like: ...
0
votes
1answer
14 views

Column 'x.Id' is not the same data type as referencing column 'y.xId'

Its my user model public class Users { private long id; private String userName; private String normalizedUserName; private String email; private String normalizedEmail; ...
0
votes
0answers
11 views

Native Query to Return POJO and Query is on tables of different DB's

I have query on multiple Tables which are across different schemas and I want to convert the result from query to POJO so that I can return the JSON response. I have tried @SqlResultSetMapping with @...
0
votes
0answers
7 views

Hibernate Criteria query doesn't give the complete result

Criteria criteria = createEntityCriteria().addOrder(Order.asc("dtname")); ProjectionList projection = Projections.projectionList(); projection.add(Projections.distinct(Projections.property("dtncode")))...
0
votes
0answers
24 views

Handle Database Connection Errors in Spring Boot during startup and after startup

I have following configuration in application.properties: spring.datasource.url=jdbc:postgresql://localhost:5432/demodb spring.datasource.username=postgres spring.datasource.password=password spring....
0
votes
0answers
14 views

org.hibernate.MappingException: Could not determine type for: Class at table: table1, for columns: [org.hibernate.mapping.Column(end_table2)]

I know this kind of questions has been posted before. But I tried all the solutions online and none of them fixed my problem. I work on Spring-MVC project, in the business logic layer I define several ...
0
votes
1answer
12 views

Error deploying tomcat webapp | java.lang.IllegalStateException: ContainerBase.addChild

i'm trying to deploy a java web application which uses spring and hibernate but i'm getting the following error logs in tomcat when it tries to start it. 25-May-2019 04:16:21.967 WARNING [Thread-8] ...
0
votes
0answers
4 views

What would be a good project design or layer separation for hibernate transactions?

What would be a good project design, a good layer separation in project with hibernate (without spring) in which I need to create a transaction that persists two different entities (all or nothing) I ...
0
votes
0answers
16 views

hybrid JPA repository / REST respository entity - hibernate

I'm wondering if there is a feature on hibernate (or JPA spec) that allows me to have some fields of an entity being fetched from a whole diferent type of repository (rest in this case). @Entity ...
0
votes
0answers
11 views

How to cast Oracle column CHAR(1 Byte) to java String Hibernate

I have this case, in oracle data base I have a column char(1), I get in java with hibernate value 1 in my property, but in db it havs 'A', what can i do? mycolumn CHAR(1 Byte); @Column (name ="...
0
votes
0answers
9 views

Hibernate Custom Basic Type with Database Function

I'm making a custom Hibernate type using AbstractSingleColumnStandardBasicType to automatically convert the SQL UDT into a Java type. The SQL uses database functions to construct and serialize the ...
0
votes
0answers
15 views

How to handle in Hibernate multiple table entities that share the same composite id in the database?

My main table has a composite primary key where one of the fields is a sequence. It has a one to one relationship to two other tables where the composite key is the primary/foreign keys of those ...
0
votes
0answers
8 views

JPA, Hibernate validators - NotBlank validator not applying on String

I'm trying validate bean through controller Stack: Spring boot 1.5.4, spring-boot-starter-web, spring-boot-starter-jdbc, Hibernate Validation 5, DB2 HV000030: No validator could be found for ...
0
votes
0answers
10 views

grails 3.3: org.hibernate.TransientObjectException with findOrSaveWhere

In bootstrap.goovy, we need to create the static/test database records if they don't already exist (i.e. created when app was previously run) def admin1 = Operator.findOrSaveWhere(username: "admin",...
0
votes
0answers
13 views

Two identical tables(with diff table names) mapping in spring data JPA for get, post and put calls

I want to use inheritance or some clean JPA logic so that i dont have to replicate my code to perform POST, GET and PUT operations on 2 identical table objects using spring data jpa I have 2 ...
1
vote
0answers
15 views

How to add a second datasource to a Micronaut project?

I have a java Micronaut project and want to add a second datasource. My Code is working fine as long, as I add the second Datasource. The documentation just said, that I have to add a new source under ...
0
votes
0answers
15 views

How do I know if the prepared statements are cached?

I am using Hikari with SQL Server 2016 and sqljdbc4-2.0.jar in the tomcat lib folder. My configuration for db resource is as follows: <Resource name="jdbc/SQLServerDS" auth="Container" type="...
0
votes
0answers
10 views

How do I add an @OrderColumn to an existing @ElementCollection table in JPA using hibernate?

I have an existing entity with the following annotations @Entity public class Inventory { @Id private String id; @ElementCollection private List<Long> items; } which creates a ...
0
votes
0answers
18 views

How put list object from JSON in MySQL

I need to put and get data from MySql with spring boot (Hibernate, Jackson) Sample JSON: [ { "name": "Product1", "colors": [ { "color": [ ...
-1
votes
0answers
13 views

Spring Boot 2.0 Hibernate 5 EhCache 3 with JCache

I'm trying to setup Hibernate with EhCache as the second level cache but the TTL is not working. Here are my dependencies: <dependency> <groupId>org.springframework.boot</groupId&...
0
votes
0answers
39 views

Require a solution to org.hibernate.NonUniqueObjectException

Basically, I require a way to update mapped objects in Hibernate. To be concise, I have class A which has List<B> as a @OneToMany mapping. I have a class B which has an object of A and @...
0
votes
0answers
13 views

Getting “Unknown system variable 'tx_isolation'” error using c3p0 connection pooling

I am trying to use c3pO connection pooling but getting below error: Unknown system variable 'tx_isolation' I am using below jars: mysql-connector-java-8.0.16.jar c3p0-0.9.5.3.jar mchange-commons-...
0
votes
3answers
39 views

Springboot data-jpa findByDate()

I'm trying to retrieve Today's records from mysql database. I tried using springboot data-jpa and the findByDate(Date date, Pageable pageable) method from jpa-repository and it always return empty ...
0
votes
1answer
26 views

java.sql.SQLSyntaxErrorException: Unknown column 'column_name' in 'field list' - mappings in entity are the same in as database

I receive the error as in the title for column "accepted_at",however i cannot see where i am making a mistake because i checked the names of the columns and the entities seem to be anotated properly....
0
votes
0answers
7 views

Login Page should show only Once in the App spring 5

I am making a webApplication on Spring mvc with hibernate. I am facing a problem . I want that the user should not be able to see login page after successfull login once. What should i write in my ...
0
votes
1answer
29 views

Many to Many relation with dependency inversion

I have a multimodule application with two modules: department-management communication-management now in my department-management i have an entity Department and in communication-management module i ...
0
votes
2answers
37 views

Spring boot - Configure second datasource along with gloud gcp postgresql primary datasource

Setting up our Spring Boot project we have a database hosted on Google Cloud Gcp. We use Spring Data JPA to manipulate our database objects and it works great. application.yaml spring: jpa: ...
0
votes
0answers
9 views

Is it good practice to fetching cached entities eagerly?

I have many reference/lookup entities, these entities are rarely changes and most of it uses second level caching. And I'm currently loading these entities eagerly(almost in all association types. -...
0
votes
0answers
9 views

AWS RDS MySQL character set

I've deployed an app to aws with elastic beanstalk (by this tutorial) I'm getting an error about cyrillic characters. For example "Привет" is being saved as "??????". So I tried to a new parameter ...
0
votes
3answers
49 views

how to solve my database problem? (MappingException)

I'm studying spring boot 2 and hibernate 5. This time, I used two tables and the one to many relationship. The error occurs here. I already found some tips in stackoverflow, such as modifying ...
1
vote
2answers
22 views

How to query/call @JoinTable annotation of hibernate from java

I have created two tables: Project and Resource. There entity class are as follows: @Entity @Table(name="project") public class Project { @Id private int projectId; private String ...
2
votes
1answer
29 views

Spring JPA: Cause path expected for join

I'm using Spring jpa to get data from two tables, but when I get data with query, it happen an error.. two table: Trip and Trip Status My model: my entities: @Entity @Table(name="trip") public ...
1
vote
0answers
30 views

Hibernate: Caused by: java.sql.SQLException: Table/View 'USERS' already exists in Schema

I am on Java SE 8, and I use the Hibernate ORM for persistence. Hibernate 5.3.6.Final Derby DB 10.14.2.0 The Hibernate Config: <property name="hibernate.dialect">org.hibernate.dialect....
0
votes
0answers
22 views

Error creating bean with name 'entityManagerFactory' - Spring boot doesn´t accept my entityManager

it is the first time I write in here since i am learning programming. I am starting a personal project using Spring Boot and it is been 3 days facing a severe problem. No matter where I look, even ...
1
vote
0answers
18 views

Is Hibernate ORM compatible with GraalVM native image compilation?

The native image compiler in the GraalVM project has, according to the docs, some limitations with dynamic proxies. Since Hibernate makes extensive use of proxies, can it work normally in a project ...
0
votes
2answers
19 views

How to solve the targeting an unmapped class error from hibernate?

I'm trying to map 2 entities (Course and Student), I have 2 Java classes and 2 MySQL tables, having a ManyToMany relationship. I created the junction table and java class Enrolment (as I want extra ...
0
votes
0answers
9 views

jpa/hibernate entity mapping from lookup table id

I have a JPA entity called Client, and a Client can have a ClientStatus. The client status is an id based on a lookup table. I wanted to create a new Client entity and save it with a ClientStatus (...
0
votes
1answer
31 views

How to fix 'ERROR: Incorrect DATETIME value: %%' in spring data?

I have a page that requests a list of items with a search function. I just want to point out that this code works perfectly on my work laptop and deployed on my live server but on my home laptop I ...
-1
votes
0answers
30 views

ORA-02292: integrity constraint (JSPPROJECTDATABASE.FK_BOOK_ID_BOOK_TABLE) violated - child record found

I wanted to delete the value of BookOrder with respect to its id but there are SQL statements according to hibernate and an error here. Hibernate: select bookorders0_.ORDER_ID as ORDER_ID1_1_0_, ...
0
votes
0answers
12 views

Error integrating persistence in a Java application deployed in Web Logic 12c

I am trying to deploy a java 1.8 application on a Web Logic 12c server using persistence, at the time of deployment it marks me an error with persistence (java.lang.NoSuchMethodError: javax....
0
votes
0answers
8 views

Request over multiple schemas with Hibernate Criteria Api

As we have a multitenant database, it is not an option to specify the schema name in the @Table definition. The entity manager used when building the criteria request is therefore bound to a specific ...
0
votes
0answers
9 views

Hibernate vs EclipseLink CMT & BMT managed transaction

I have: @Stateless @TransactionManagement(TransactionManagementType.CONTAINER) public class HalloEjb implements HalloEjbLocal { @PersistenceUnit(unitName ="testPersistenceUnitBMTHibernate") public ...
0
votes
0answers
22 views

Pass Values to a generic Method dynamically

I am using Hibernate and I have Many methods of this type: public static void modifySchemeEvents(String schmCode, String username) { Session session = HibernateUtil.getSessionFactory()....
0
votes
1answer
21 views

how to fix “getOutputStream() has already been called for this response”

i get the following Exception "java.lang.IllegalStateException: getOutputStream() has already been called for this response" when i want to export data from database to excel file. /**** Service ***...
1
vote
1answer
40 views

Hibernate Lazy Loading doesn't work with forEach() in java 11

I don't know where one reports java bugs. I can honestly say I've never seen one before. BUT the lazy load of hibernate JPA and Java foreach doesn't work in Java 11.0.2. I do not see it listed as ...
0
votes
0answers
21 views

having an Hibernate entity with a count children column - without scalar subquery

I have an entity and I want it to have an attribute of the count of the children. Let's say I have these two tables: create table father ( id int, name ); create table child ( id int, ...
0
votes
0answers
22 views

generate jpa entity from ms sql database [on hold]

I want to generate entities from mssql database. I try to create jpa project for this. In jpa project creation steps when I need to add connection I choose driver for it (mssql-jdbc-7.2.2.jre8 for) ...
0
votes
1answer
23 views

Spring data jpa: required identifier property not found for class ConnectionManager

I get the error "required identifier property not found for class ConnectionManager" when trying to save a ConnectionManager class through a CrudRepository in the controller method. I have a ...
0
votes
0answers
13 views

Making full text search with Postgresql and hibernate - missing type for tsvector and operator @@

I have postgresql database where I'd like to run full text search queries by using JPA/Hibernate criteria API. My issue is that I don't know which type should I use for tsvector type and what is a ...

http://mssss.yulina-kosm.ru