Skip to content
Advertisement

Tag: hibernate

Create custom finder with spring

I trying to implement a database with a many-to-many relationship.The database has been built, now we need queries to it. I’m using this article as an example: https://www.bezkoder.com/jpa-many-to-many/. When I create custom finder in Repository – server crushes at running. I have two Entity: MassageEntity and RstringsEntity. I’m trying to create a method List<MasageEntity> findMasageEntitiesByRstringsEntitiesId(Long string_id);. Without that method server

SessionFactory addAnnotatedClass method not found

I am following a spring course covering hibernate and I think I’m missing something in my pom.xml. Java cannot find the addAnnotatedClass method. The class I’m watching isn’t using maven and I didn’t want to download all of the jars manually. The documentation has the method here that isn’t deprecated. Pom.xml Edit: Correct Pom File Answer May be your hibernate

Hibernate: mapping with a map and getting argument type mismatch

I’ve got this class DepartmentPerson in Java where I’ve mapped a Map in Hibernate as following: and in the class I have acceptByPeriod defined as following: Whenever I run a query on DepartmentPerson, I get the message: “java.lang.IllegalArgumentException: argument type mismatch”. This has something to do with the acceptByPeriod mapping, as when I remove it the problem disappears. All 3

Unable to fetch Parent data from Child

I’m trying to see whether a Cab is assigned to any Employee so I can fetch that Employee Id and simply to set cab as null, but @OneToMany mapping, simply returning a list of Employees & by this I’m not getting any method like a cab.getEmp() to fetch employee details Employee.java Cab.java Controller Answer In your code, Cab is perent

Java ORM vs multiple entities

I have a class Health Check – as part of the class I record how many parasites are seen (enum NONE, SOME, MANY) and also the location of the parasites (enum HEAD, FEET, BODY). Two ways this could be done: METHOD 1 Health Check Parasite Or I could have: METHOD 2 Would method 1 require @Entity on parasite class and

Advertisement