Spring boot Jpa add object field use database default

jpa is used as the persistence layer framework. The database fields in the project have default values and non empty constraints, so it is necessary to save a complete object when saving objects. However, in development, we usually only save some special fields first, and use the database default values for the rest fields. If we directly use i ...

Posted on Sat, 16 Nov 2019 16:50:46 -0500 by biba028

mapper implementation of mybatis

Mybatis is often used in projects, and hibernate was slowly abandoned many years ago.I haven't blogged for a long time since iteye was acquired. This year I want to make up for it by writing more.Today, let's talk about the mapper implementation of mybatis. @Component public interface ActivityMapper {/** Add prize record @param prizeEnti ...

Posted on Thu, 07 Nov 2019 10:51:56 -0500 by BrianG

Hibernate 4 + MySQL demonstration of Chinese naming

Recently, there is an opportunity to verify the feasibility of Chinese naming in a given development environment. The source code of the example is as follows: HibernateExampleZh Currently, Hibernate 3.3.2.GA is used. Later, more versions are tested. See the last part for eggs Test environment: Windows 7 Pro 64bit, JDK 1.7.0_80, MySQL 5.5.62, ...

Posted on Mon, 04 Nov 2019 12:20:16 -0500 by brucec

Spring 3 integrates hibernate 3.5 to dynamically switch SessionFactory

Implementation code 1,Define global switch SessionFactory Tools   package com.hoo.framework.spring.support;   /** * <b>function:</b> Multiple data sources * @author hoojo * @createDate 2013-9-27 11:36:57 am * @file CustomerContextHolder.java * @package com.hoo.framework.spring.support * @project SHMB * @blog h ...

Posted on Sat, 02 Nov 2019 23:14:42 -0400 by just me and php

How to automatically generate database table structure summarized by Mybatis

In general, when using Mybatis, the table structure is designed first, then entity classes and mapping files are written, especially when using code generators. But sometimes I don't want to use code generator or define table structure. What should I do? At this time, I will think of Hibernate, and then I will think of its hibernate.hbm2ddl.a ...

Posted on Fri, 01 Nov 2019 08:20:38 -0400 by dgudema

HibernateSystemException: Found shared references to a collection:

I made this mistake when I was writing the project today. rpd] 2019-07-13 16:08:31 ERROR GlobalExceptionHandler: Found shared references to a collection: com.rpdgd.freemarket.business.ship.domain.FreeMarketShipPlan.shipWeighDetail; nested exception is org.hibernate.HibernateException: Found shared references to a collection: com.rpdgd.freemark ...

Posted on Mon, 28 Oct 2019 17:23:53 -0400 by dank

Entering the world of Java Web Technology

This series of articles will be organized into my "Java interview guide" warehouse on GitHub, and more highlights can be found in my warehouse. https://github.com/h2pl/Java-Tutorial If you like, please point to Star ha. The article started on my personal blog: www.how2playlife.com This ...

Posted on Thu, 24 Oct 2019 09:15:43 -0400 by CanWeb

One to many association mapping of hibernate in java

This article focuses on one-way one to many association mapping in Hibernate 1. In applications, sometimes it is necessary to obtain data from one end and multiple ends. For example: view all book information under a certain category; view all goods under an order, etc. 2. In the one to many relationship, the design of the table is as follows ...

Posted on Wed, 23 Oct 2019 12:33:32 -0400 by Nugen

HQL and paging query of hibernate

HQL and paging query of hibernate I. HQL 1. What is hql HQL is the abbreviation of Hibernate Query Language 2. Differences between hql and sql: 1. First of all, hql is object-oriented; sql is database oriented. 2. The syntax structure of hql: from + class name + class object + where + class object at ...

Posted on Mon, 21 Oct 2019 17:11:33 -0400 by JoeDaStudd

Spring Boot 2 + Thymeleaf: server side form validation

Form validation is divided into front-end validation and server-side validation.In terms of server-side verification, Java provides JSR 303 specification which is mainly used for data verification, while Hibernate Validator implements JSR 303 specification.When project dependency is added to spring boot starter thymeleaf, Hibernate Validator de ...

Posted on Mon, 21 Oct 2019 14:11:43 -0400 by MindOverBody