Storing one to many object relationships using Hibernate

There are often relationships between objects in life, such as one-to-one, one to many, many to many. For example, there are many students in a Course class who are one to many. In the database, you can add a foreign key to the Student table to point to the class id to indicate that the Student conta ...

Posted by monkuar on Thu, 27 Feb 2020 03:24:00 -0800

hibernate tutorial note 3

Why to learn HQL (hibernate query language) - > this is an official recommendation with powerful functions ? delete Session.delete (object) - > batch delete Add? session.save session.persist Modify - > batch modify Sessin.update (object) Query object obj obj.setXXX(); Query? load get Query all ...

Posted by trilbyfish on Mon, 17 Feb 2020 00:38:56 -0800

Infinite recursion and Jackson JSON and Hibernate JPA problems

When trying to convert a JPA object with two-way associations to JSON, I kept org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) All I found was The thread , basically ending with a recommendation to avoid two-way Association. Who knows the wrong solution this spring? ------Edited on July 24, 2010 16 ...

Posted by Xzone5 on Fri, 14 Feb 2020 06:14:15 -0800

Spring MVC application (data binding - custom type converter, data format, data verification)

1, Ask questions When spring MVC encapsulates custom type objects, JavaBean s are bound to the data submitted by the page one by one. Here's what you need to know: 1) all data submitted by the page are strings 2) attributes in JavaBean s, such as Integer age; When binding data, the following oper ...

Posted by saeed42 on Wed, 05 Feb 2020 22:31:22 -0800

Spring Boot: web application development and CRUD implementation

1, Developing web applications Spring Boot Web development is very simple, including common json output, filters, property, log, etc 2, json interface development In the past, when using spring to develop projects, what needs to be done when you need to provide json interfaces? 1. Add related jar packages such as jackjson 2. Configure spri ...

Posted by Mikedean on Tue, 04 Feb 2020 23:11:06 -0800

spring data jpa many to many relationship reports a missed entity passed to persist error

Recently, when spring data jpa is used to maintain many to many relationships between tables, a strange problem arises. When a new object is put into the entity class to maintain many to many relationship set, and then saved with jpa, the following exception will appear. org.springframework.dao.InvalidDataAccessApiUsageException: detached enti ...

Posted by Shadow Wolf on Fri, 17 Jan 2020 00:58:31 -0800

springmvc+spring4.2+hibernate5 Integrated Records

1, Profile There are a lot of jar packages involved. Here I choose to help me manage jars by maven <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache. ...

Posted by uglyrat on Sun, 12 Jan 2020 06:08:38 -0800

Annotation analysis notes such as JPA one-to-one mapping@OneToOne

I've uploaded a two-way, one-to-one instance to GitHub, the entrance project, and downloaded and run if you're interested, here are two running problems. Question 1: I left a question at the end of my last blog post.One-to-one Association query comment @OneToOne instance details Problem point: At the en ...

Posted by dsjoes on Fri, 10 Jan 2020 18:19:32 -0800

Spring datajpa example condition paging query instance

The article refers to: https://blog.csdn.net/long476964/article/details/79677526   . This article introduces the use of the Example class. Spring datajpa official document: https://docs.spring.io/spring-data/jpa/docs/2.0.9.RELEASE/reference/html/#query-by-example (English tycoon moves here) spring data jpa Example condi ...

Posted by robertaccettura on Wed, 01 Jan 2020 03:45:28 -0800

Use of hibernate's @ EmbeddedId annotation

I. Preface When we design tables for projects, sometimes we need to use composite primary keys to identify uniqueness. If the project's persistence layer adopts hibernate framework, we can use @ EmbeddedId annotation to achieve this requirement. 2, Table design CREATE TABLE `mkt_mas_cpcus` ( `CR_ORG_NBR` decimal(3,0) NO ...

Posted by bass123 on Tue, 31 Dec 2019 22:30:03 -0800