Jpa Questions
Ad
Compound keys in JPA
I want to make an entity that has an autogenerated primary key, but also a unique compound key made up of two other fields. how do i do this in
Failed to convert property value of type java.lang.String to required type java.util.Date for property dateEmp;
A java ee project using spring framework (spring-boot).
Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'date': it is not exactly10characters long
In my code i have two entities busdetails and user. the user and the busdetails has many to many relationship. whenever i try to book bus, the
JPA - Write a "Reverse" like Predicate (like operator applied on column instead of inparam) - Oracle DBMS
I need to write a "reverse" like condition with jpa predicate over oracle dbms. the example query i need to build is:
TransactionRequiredException when updating with Jpa Repository
On succesfull authentication i'd like to make a call to db to retrieve some additional info but i get:
Can I inject properties into a JPA Entity Listener
I could prototype this and see what happens, but i am being lazy. i want to be able to inject an ejb3 into my jpa entity listener so that it can
Hibernate.initialize() and second-level cache
Does anybody know if hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level
Enabling Hibernate second-level cache with JPA on JBoss 4.2
What are the steps required to enable hibernate's second-level cache, when using the java persistence api (annotated entities)? how do i check
JPA repository Boolean Query - return null pointer exception
I have java springboot project with repository that included boolean custom query. but the system run to null pointer exception apart from return
Incorrect auto-generated SQL query in Spring Boot (JPA) CrudRepository
My repository interfaces: songsrepository: public
Ad
OR condition doesnt work properly in JPA Query
I have the following entities class productunitofmessure @manytoone @joincolumn(name="product_id") private product
Does hibernate set back reference in @OneToMany @ManyToOne relationship automatically?
I have order entity that has orderitems list. @onetomany(mappedby ="order") list<orderitem>
Spring Boot : mapping between entity and database not working.(Getting {} in response body)
I'm trying to create a webservice but when i try to get records from database(mariadb), the response is being shown as {} and does not show the
Incompatible type referencing and referenced column in Spring Data JPA
I want my ids to be uuid and there should be many-to-one relationship between student and course. i am getting incompitable types referencing
Spring-Boot MVC JPA Filters
Let me start by saying i'm fairly new to spring boot so apologies if i'm making a silly mistake somewhere. i am trying to retrieve the value of my
More sort column in JHipster
I try to configure sort column using the rout.ts file of my entity. in the "data" tag i put defaultsort:
What is the most efficient way of updating multiple records in Oracle with same value
We have a batch job that needs to update millions of rows (not all rows) of a table with a particular value. we have the following
H2 - Hibernate not inserting Default column values on SQL INSERT
I'm developing a service and currently working on 2 of its entities (section and gradelevel) while i'm still developing,
Can I find by a list of IDs instead the classic findById() in Spring Data JPA?
I am working on a spring boot project using spring data jpa and i am wondering if exist a nice and elegant solution to the following use case.
How can I correctly implement a Spring Data JPA repository method retrieving all the objects related to a list of object? (not to a single one)
I am working on a spring boot application using spring data jpa and i have the following problem. i have this eventlog
One-Many Relationship in Jpa
I want to get data from my entity with 1-m relationships. users have an entity for cv information.with jparepo, cv class : @entity
Ad
How to use deleteById jpa repository if my id is a String?
I need to delete an entity using its id, tried using jpa repository delete by id method productrepository.deletebyid(id);
Add ModelMapper Maping from Entity Class to Dto Class with OneToMany relationship
I have that relationships (spring boot jpa implementation): one person have multiples addresses one address contains one country
JPA/Hibernate Entity show only some fields on GET
I have an entity that has many fields mapped to columns in my database using the @entity and @column annotations. columns might include something
JPA: fetch posts with vote cast by a specific user
I need to load the post entities along with the postvote entity that represents the vote cast by a specific user (the
Property or field 'location' cannot be found on object of type javascript
I having troubles to get the object in javascript expression thymeleaf, how can i resolved? i m trying to fill a select option with the
Understanding Relationship Cascading with Merge
Deep diving into spring jpa and i have troubles to understand whats going on here. this is the code: entity
Check existence of multiple IDs with Spring Data JPA
Analogous to the built-in method existsbyid i'd like to hava an existsallbyid method with spring data jpa. to achieve
JPA: how can i map a property to a derived column that is based on a COUNT from other tables (Without incurring in n+1 select problems?)
These are the entities defined in my project: post @entity public class post implements serializable { public enum
The Parent entity inside child entity pull the child again
When i try to fetch the child entity, it also gets the parent entity because of one to many bidirectional mapping but the parent entity inside the
Android room relations
I have two entities that looks like this (simplified for reading purposes). @entity public class machine { @primarykey
Spring Boot REST Hibernate - Get all the cities of a country
With this code: city.java @entity @table(name = "cities") public class city extends auditmodel { @id
Ad
QueryDSL 4.1.4, Jpa GROUP BY Date
I have troubles on grouping my query by date. i need to consolidate some data in daily manner in querydsl 4.1.4. there is almost none
How to expose fields of and @EmbeddedId
I have an @entity with three fields a, b, c out of which a and b act as composite primary key. i created an @embeddedid
setParameter issue with createNativeQuery of entityManager JPA
I want to apply parameter binding to the dynamic native query where the column name which i am fetching i will be passing that dynamically from
class path resource [org/quartz/impl/jdbcjobstore/tables_h2.sql] cannot be opened because it does not exist
I am trying to use h2 database to test my quartz application which is running using spring boot. my application.properties looks like this :
Does EntitiyListener run in same Thread?
I have an entity which is annotated with @entitylistener(mylistener.class) in the class mylistener, i have an
Pagination with JPA Criteria API involving complex criteria
I am trying to paginate results with the jpa criteria api. after looking through this answer:
Spring Boot MSSQL Kerberos Authentication
Currently in my spring boot application.properties file, i am specifying following lines to connect to mssql server.
Spring JPA data: Querydsl in eclipse giving compilation error while using query dsl classes
I have added below query dsl plugin in eclipse to generate qdsl classes. while using dsl classes in my repository its giving complication
How to create sequence in JPA without creating directly in Database
I am doing a service that get data from a source and fetch them into my database by using jpa. the id is generated by using sequence. i have
JPQL inner join query
I am stuck in a tricky situation while writing a jpql query, following are my tables:- order_ order_id
Query annotation for spring-data-jpa
Hy all, i would like to know what is wrong with my custum query using spring data jpa. if i use
Ad
Change a jPanel Background Color to an RGB Value
I'm trying to make a simple hello world app that changes a jpanel's background color to a random color when you click a button. here is my
JPA Repository and constructor with varargs
It is possible to use constructor of varargs in @query (org.springframework.data.jpa.repository). what i mean is class like this:
@Primary JpaRepository not used for @Autowired
I have the simplest of spring configuration cases so i don't know why i don't find how this is done. i have an interface
Oracle Sequence getting updated by cache size+lastnumber
The sequence in oracle db is getting updated by cache size+lastnumber value, when app server(tomcat) gets restart. my application is using
In JPA, relational databases and etc., What is a Tuple?
I'm studying hibernate and jpa, and i am finding this term all the time. could someone explain me in a practical and didactic way, what is this
LazyInitializationException: could not initialize proxy - no Session
I use spring-data-jpa with spring-boot(v2.0.0.release), i just wrote a crud demo on mysql, but an exception occurs
JPA get MIN/MAX attribute of connected entity
Consider the following two entities: @entity public class hostmachine { @manytomany(fetch = fetchtype.lazy, targetentity =
Spring Data JPA query method 'Desc' not recognized
I have the following domain object: public class quizz { private long id; private date when; private long userid; }
JPA optimistic locking vs synchronized Java method
Using jpa optimistic locking we can control via a @version field if a database table has been updated by another transaction at the same time,
JPA session with lazy collections in Vertx EventBus consumer
I have created a consumer on vert.x eventbus: @autowired private vertx vertx; public void registerconsumer() { eventbus eb =
Hibernate don't cascade update on specific field
I have a mapping problem with hibernate. in a @onetoone relationship, i don't want to cascade the update to the partner. this is my
Ad
Can I define the Entity Listeners in the Same Entity Class?
E.g., will the below code run properly? or do i have to define a separate entity listener for each and every entity class? @entity
What is a viable alternative to getOne(long id) in Spring
I am writing an update method in spring service and it says the getone() is deprecated, i have reviewed alternatives and the
On which side must I define a @JoinColumn annotation for a @OneToOne relationship like this?
Say i have a relationship like figure 1 (@onetoone between customer
Holding a constructed table using JPA
I've a database structure built with jpa. to give a little bit context - the user is shown a datatable and some (many...) filters with which he
Referential integrity constraint violation with Cascade type ALL
I need your help with the following problem: there is a spring boot project, it has two entities: bank and creditdetails, the bank refers to the
How to filter a @OneToMany mapped field in spring data JPA?
I am trying to build an expense tracker application using spring boot rest api. the following are the entity classes i have created. user
Changing JTextFields when not within a certain range & changing JPanel background using text from JTextFields
I have looked around and found various bits and pieces of information that have helped me so far but i am currently stuck with the following
Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Set, at table:
I want to create jpa repository for spring authorization server using this code:
Multiple Spring JPA relationships between 2 entities
I have 2 entities, one for a tasklist and the other for users. the users can create tasks for themselves or their friends, so in the tasks entity
Spring Boot OpenAPI 3 with Spring Data REST
I'm failing at documenting my spring data rest api with openapi. nothing show in swagger-ui's homepage (and /v3/api-docs obviously). here
JPA : insert and delete object in same transaction
I want to insert an object into database in a transaction and after that object is saved in the database, i'd like to delete that it once a
Ad
Spring Data cannot fetch a record using UUID in postgresql
I am using spring data to manage a rest api. all tables in my postgresql database has a primary key of type uuid. i am able to persist this data
Spring Data JPA - bidirectional relation with infinite recursion
First, here are my entities. player : @entity
no setter methods in generated mapstruct implementation
I'm experimenting with mapstruct and follow this tutorial:
How to make a JPA query use primitive ID instead of managed instance?
I tried but i couldn't find a better title so it looks weird but the question is actually very simple... i have a jpa query which uses a
Update by JPA native query
I am using spring boot repository with native query. while i am trying to update few fields by query and supply wrong values it is not throwing
Post method and String value in Java Spring
I'm trying to post a text from home.html template <form th:action="@{/process_addtext}"
Optional objects spring boot - get object fields
I have defined customer entity @entity @table(name = "customer") public class customer { @id @generatedvalue(strategy =
Java Spring JPA Pagination Not working if more than one Page
I'm trying to use jpa pagination with custom query. pagination is working if match with 2 cases. case 1 : if data
Working with indexes when using Spring boot + Postgresql
I know that i can create an index for both a single column and a composite one. a also i can make an
DdlTransactionIsolatorJtaImpl could not locate TransactionManager
So, i've been trying for many days to run my project, without success. spring boot + hibernate + jpa. oracle database. can anybody help me?
Spring Boot JPA initialize data - Syntax error in SQL statement ... expected "identifier"
Try to implement data into my spring boot application at the start up. as i researched it should be working like this: user_role
Ad
Nested entities contains null after save
I have an entity with some nested entities like this public class myentity { @manytoone
JPA composite key (FKs + date) set date to auto_increment
I am working on a java play project and trying to create a time tracker for users on projects. i have the following class for tracking time:
Hibernate 5 ignores @Table schema param
In my application there is an entity: @entity @table(schema = "hr", name = "personal_data") public class personaldata { }
Result from JPA project is null
I have these postgres tables: create table deals_new ( id bigserial primary key, slip_id text,
Set value on additional attribute in @ManyToMany relationship table spring boot
I have a @manytomany relationship table between user and diet classes. the table (userisonadiet) has 2 additional columns: fromdate (starting the
add a dynamic column to an entity without saving it to the table
I have a model class like the following: package com.example.model; import java.util.map; import javax.persistence.column; import
Enabling exception translation for JPA in plain Spring
I was setting up a basic crud web app with jpa in plain spring (no spring boot or spring data jpa) for educational purposes and faced a strange
how to deserialize one to many relationship with both eager sides without ending up in infinite deserialization loop
Here is my product class @entity public class product { @manytoone(fetch=fetchtype.eager)
Spring STS DB connection with Jpa
I am studying spring sts and trying to connect db with jpa. i am unfamiliar with spring so i have problem in connecting db.
Hibernate Spring JPA Session: A different object with the same identifier value was already associated with the session
I am making a webshop in java and i am currently working on the stock of the product. everything is working fine, however i seem to get this
What is a good way to handle an Optional<User> object returned by a Spring Data JPA repository in a situation like this?
I am working on a spring boot application. into a service class i have this service method: @override public user
Ad
I am not able to search my users by email using JPA spring boot
Controller package com.bird.bird.controllers; import com.bird.bird.entity.manager; import
Spring Data Rest - Self link of association resource
This is the json-response of a get-reqeust: { ... "_links": { "self": { "href":
How do you draw a JPanel on top of another?
So i have 2 jpanels, stopwatchdial, which are basically just circles with their constructor being (topleftx, toplefty, diameter, and last
Diffrence between JPA API and hibernate native API
I am still a beginner in hibernate.i have started reading the user guide in which i found this
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified
I have created a basic spring boot application from spring initializr with the web, mongodb and jpa dependencies. when i
Why this Spring Data JPA query by name method gives me this error and Eclipse forces me to return an Optional<User> instead a simple User object?
I am working on a spring boot project using spring data jpa and hibernate mapping. in my repository classes i am using a query by method
Cannot acquire data source [java:app/projectName]
I am new at jpa , i use glassfish 4.1.1, when i try to create an entitymanagerfactory it shows this exception message:
I am trying to write a jpa query for subqueries
I am trying to write a jpql query for subqueries. the query is as follows. select fos_name, count(allocation_bucket) as
n+1 issue in one to one relation with Lazy Loading
My question is when an null ability occur in one to one relation even my child class primary key same like parent class primary key so when
How to fix failed to lazily initialize a collection
When i try to get data from db about user, i get the following error: request processing failed; nested exception is
Spring Boot Postgres JPA, not returning the Primary key in response of findAll()
Employee class @entity @table(name = "employees") public class employee { @id @generatedvalue(strategy =
Ad
Repository annotation is not working on Spring data JPA
I am building a spring-boot application where i am using spring data jpa feature. please find below my dao layer code
How to check if table contains column in JPA - Criteria API?
I joined two tables and get different columns from both tables to load them into datatable. i want to order the columns by using datatable but how
Ad
Blog Categories
Ad