In my application, I have 3 tables: recipes ingredients recipes_ingredients I need to find all those recipes that contain a list of ingredients_id and that I have in my food storage and containing NO OTHERS ids outside the list I provided (so not in my food storage). Example: i provide oil (id=111) bread=(id=222) result recipes: OK oil+bread OK bread OK
Tag: spring-data-jpa
how do i save a new student that contains entities, but don’t create these entities because they already exist in the database?
I want to save a student and a student has a TargetAudience object as an attribute. These target audiences are allready hardcoded in my database. (targetaudience = campus + major). Now when i post like this: it doesnt work because everythime it creates a new object for the campus and because i use name as a primary key it throws
Why Multiple Where Clause not Woking in nativeQuery
IT will gives error But when we use single where clause its working and my response is But my problem is based on queryParm as userId we get data not all, so i added multiple where claues we get error please help me for that. Answer So AS you look at the error message it obviously said that the parameter
Deadlock when we we have dependent entities in hibernate and try to update table using multiple threads in Vertica
I have two java classes. Father.java and Children.java I receive the Deadlock X exception if several threads visit the same table (entity father) to updates with distinct row entries, even though the records are different. Is there any way to fix why the entire table locks up instead than just one row? Even though I haven’t updated or added anything
Hibernate – make id value be able to be autogenerated directly in datasource as well
I’m making a Spring boot application with Hibernate ORM framework. I have an @Entity class in my code: I successfully can persist a Thing to my datasource. And thing_id is generated as expected. But I cannot insert a record directly in database manager (e.g. DataGrip): I have a warning and appropriate error when trying to insert: So how can I
SQL Query OneToMany Filtering with child entity but returning parent
Hey I need some help with an SQL Query I just can’t figure out. I got these two Tables with an OneToMany/ManyToOne relation: Now I got this select query to get me all Books that have been written before the current date: (I’m doing this in Java JPA via the Query Annotation) In this case I am returning all the
JPA Subquery fails
Does anyone know why it fails? It does not give syntax problems but it gives me the error “missing expression (ORA-00936)” The problem seems to be in :user IN uc.users Answer I think the last bit is incorrect. This should work: So, the whole query becomes:
Spring Data Jpa to get data which doesn’t have entity representation
I’m trying to find the best way to map my data on ORM. I have a query which gets me data from MySQL database which look like What would be the most optimal way to get these data with Spring boot and Spring data?? Should I use @Query annotation and execute this or somehow create entities for Equipment and Devices
What is the best way to update data in database using Native Query
Here if one of data in rule object is null apart from rule_id(As it’s necessary) this query will fail, so instead I can format string for each value in Rule object and concat them excluding which has null value in Rule object but is there any better way to do this? Because if there are 100s of columns then this
How to create LinkedList of JPA entities
I have a scenario where I need to create an entity which has references to list of predecessors and list of successors. when a request is received, I need to create entity like below: Request: My new entity “task2” should now be created as below in DB. While saving task2 with previous as task1 and next as task3, I also