Skip to content
Advertisement

Tag: orm

Jpa unidirectional relation in the parent entity

I want to make unidirectional relation in the parent entity, Child entities have FK from the parent entity. The Name table has FK from the person table. But I just want to define the relation in person entity only. I used @JoinColumn for mapping and set name as id from the person table In the next example, I have one

JOOQ: How to resolve foreign keys as objects?

Say I have a table that references another table, in this case “TestScenarios” references “TestSchemas”. So each TestScenario HAS-A TestSchema. I autogenerated DAOs, however, when fetching TestScenario instance via the DAO the TestSchema field is an integer, not a TestSchema-object. How can I get JOOQ to resolve foreign keys directly as objects up to a certain depth? Answer DAOs don’t

What is the purpose of the Hibernate ReturningWork interface?

I am working on one JAVA + Hibernate project but currently, I saw one interface in my code (i.e. ReturningWork<Long>) which has one method called execute(java.sql.Connection). My question is what is the use of this ReturningWork interface? Answer As I explained in more details on my blog, you can use the ReturningWork and the Work interfaces to implement any logic

MySQL to Hibernate datatype mapping for type “YEAR”

There’s a column in our database which needs to be of type YEAR. What is the corresponding Hibernate mapping for the entity? Tried searching all over, but unable to find the details. I am not sure if I need to use anything from @Temporal or any other specific type. We are using Hibernate ORM v4.1.7. Answer You can write a

HibernateException: Couldn’t obtain transaction-synchronized Session for current thread

I’m getting the following exception when trying to use my @Service annotated classes: The way I initialize my application is complicated so I need to provide a link to the full base code to get additional information: https://github.com/dtrunk90/webapp-base. I’m using this as a maven overlay. And here is the necessary code: Initializer (from webapp-base): Initializer (from my webapp): @Configuration (from

Advertisement