firstname

SpringDataJPA

匿名 (未验证) 提交于 2019-12-03 00:38:01
更新删除等事务操作需要加上Transactional 方式一 @ Transactional @ Modifying(clearAutomatically = true) @ Query(value = "UPDATE User u SET u.status =?1 WHERE u.id = ?2" ) Integer updateStatusById(String status, Long id) ; 方式二 @Entity @NamedQuery (name = "User.findByEmailAddress" , query = "select u from User u where u.emailAddress = ?1" ) public class User { } https://docs.spring.io/spring-data/jpa/docs/2.0.8.RELEASE/reference/html/ Keyword Sample JPQL snippet And findByLastnameAndFirstname … where x.lastname = ?1 and x.firstname = ?2 Or findByLastnameOrFirstname … where x.lastname = ?1 or x.firstname = ?2 Is

junit5 入门系列教程-05-junit5 断言(assert)

匿名 (未验证) 提交于 2019-12-03 00:37:01
Ŀ¼ Ŀ¼ Assert Assert JUnit Jupiter附带了许多JUnit 4拥有的断言方法,并添加了一些可以很好地用于Java 8 lambdas的断言方法。 所有JUnit木星断言都是 org.junit.jupiter.api.Assertions 中的静态方法断言类。 AssertTest.java import org.junit.jupiter.api.Test; import static java.time.Duration.ofMillis; import static java.time.Duration.ofMinutes; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTimeout; import static

SQL_STUDY:12.SQL AUTO INCREMENT 字段

旧城冷巷雨未停 提交于 2019-12-02 06:45:37
摘要: 各个不同数据语言的自增键的使用 SQL AUTO INCREMENT 字段 Auto-increment 会在新记录插入表中时生成一个唯一的数字。 AUTO INCREMENT 字段 我们通常希望在每次插入新记录时,自动地创建主键字段的值。 我们可以在表中创建一个 auto-increment 字段。 用于 MySQL 的语法 下列 SQL 语句把 “Persons” 表中的 “P_Id” 列定义为 auto-increment 主键: CREATE TABLE Persons ( P_Id int NOT NULL AUTO_INCREMENT , LastName varchar ( 255 ) NOT NULL , FirstName varchar ( 255 ) , Address varchar ( 255 ) , City varchar ( 255 ) , PRIMARY KEY ( P_Id ) ) MySQL 使用 AUTO_INCREMENT 关键字来执行 auto-increment 任务。 默认地,AUTO_INCREMENT 的开始值是 1,每条新记录递增 1。 要让 AUTO_INCREMENT 序列以其他的值起始,请使用下列 SQL 语法: ALTER TABLE Persons AUTO_INCREMENT=100 要在 “Persons”

vue计算属性,方法,监听器

爷,独闯天下 提交于 2019-12-01 22:55:58
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>计算属性,方法,监听器</title> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> {{fullName}} {{age}}<br /> {{fullNameMethods()}}<br />{{fullName1}} </div> <script type="text/javascript"> var vm = new Vue({ el: "#app", data: { firstName: 'Harold', lastName: 'Jim', age: 44, fullName1: '', }, // 计算属性 computed: { fullName() { console.log("计算属性计算了一次") return "计算属性:" + this.firstName + " " + this.lastName } }, methods: { fullNameMethods() { console.log("方法计算了一次") return "方法:" + this.firstName + " " +

JS-面向对象-操作对象的属性 / 检测对象的某个属性是否存在 / 遍历(枚举)对象的属性 / 属性的分类

跟風遠走 提交于 2019-11-30 09:16:39
操作对象的属性 <!DOCTYPE html> < html lang = " en " > < head > < meta charset = " UTF-8 " > < meta name = " viewport " content = " width=device-width, initial-scale=1.0 " > < meta http-equiv = " X-UA-Compatible " content = " ie=edge " > < title > Document </ title > </ head > < body > < script > var obj1 = { fullName : '谭文华' } ; // 为对象添加新属性 obj1 . age = 20 ; obj1 [ 'gender' ] = '男' ; // 修改对象的已有属性的值 obj1 . fullName = '赵志刚' ; obj1 [ 'age' ] = obj1 . age + 1 ; // 删除对象的属性 delete obj1 . gender ; delete obj1 [ 'age' ] ; console . log ( obj1 ) </ script > </ body > </ html > 检测对象的某个属性是否存在 <!DOCTYPE html> <

linq join之后转viewmodel

纵然是瞬间 提交于 2019-11-29 18:38:40
在项目中经常会遇到几个表join之后 取出一些数据,并不是所有数据,每个表可能抽一部分出来 这个时候就需要去定义一个我们需要的页面使用的viewmodel 来接收我们需要的数据。 1:先join查出来我们需要的数据源信息 2:convertAll 将数据源信息转化成ViewModel public List<ReviewInfo> GetReviewAndStar(string tourCode, int languagesId) { var query1 = DbContext.ReviewsInfo.Where(a => a.Tourcode == tourCode && a.LanguagesId == languagesId && a.Active).AsQueryable(); var query2 = DbContext.FeedBackCityofTypeList.Where(a => a.CityOrType.ToUpper() == "OVERALL PRICE & VALUE").AsQueryable(); var query = from t in query1 join y in query2 on t.FeedBackId equals y.FeedBackId select new { FeedBackId = t.FeedBackId,

How do I delete orphan entities using hibernate and JPA on a many-to-many relationship?

故事扮演 提交于 2019-11-29 16:11:44
问题 I want to delete orphan entities using hibernate and JPA on a many-to-many relationship but all that I found was this attribute the attribute. org.hibernate.annotations.CascadeType.DELETE_ORPHAN ( i.e. @Cascade(value={org.hibernate.annotations.CascadeType.DELETE_ORPHAN) ), which works only for one-to-many relationships. I want to know if I can delete the orphan ones on my many-to-many relationship. java sql hibernate jpa share | improve this question 回答1: From the book "Pro JPA 2": Only

vue+elementui+netcore混合开发

删除回忆录丶 提交于 2019-11-29 13:34:17
1、VueController.cs using Bogus; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace WebApplication1.Controllers { public class VueController : Controller { // GET: Vue public ActionResult Index() { return View(); } public ActionResult Table() { return View(); } public ActionResult GetTable() { var userGenerator = new Faker<User>() .RuleFor(x => x.Id, x => x.IndexFaker + 1) .RuleFor(x => x.Gender, x => x.Person.Gender) .RuleFor(x => x.FirstName, (x, u) => x.Name.FirstName(u.Gender)) .RuleFor(x => x.LastName, (x, u) => x.Name

Linq实现left join左连接

回眸只為那壹抹淺笑 提交于 2019-11-29 07:24:28
Linq实现left join左连接 class Person { public string FirstName { get; set; } public string LastName { get; set; } } class Pet { public string Name { get; set; } public Person Owner { get; set; } } public static void LeftOuterJoinExample() { Person magnus = new Person { FirstName = "Magnus", LastName = "Hedlund" }; Person terry = new Person { FirstName = "Terry", LastName = "Adams" }; Person charlotte = new Person { FirstName = "Charlotte", LastName = "Weiss" }; Person arlene = new Person { FirstName = "Arlene", LastName = "Huff" }; Pet barley = new Pet { Name = "Barley", Owner = terry }; Pet boots

knockoutjs复杂对象的可观察性

不问归期 提交于 2019-11-28 23:53:52
问题 对于一般数据结构: 1、 对于基本类型的数据的变更的可观察性(observable), 可以使用 ko.observable(xxx) 来声明一个 observable对象,   或将其绑定到视图,   或将其绑定到其它 ko.computed 或者 ko.pureComputed 对象中;   或者使用subscribe单独订阅其变化。 2、 对于数组型号数据结构, ko提供 ko.observableArray(xxx), 将数组做成一个可观察对象, 并开放一些类似数组的 方法,   使用这些方法, 一旦数组发生变化, 则观察者能够被通知到。 pop, push, shift, unshift, reverse, sort, splice All of these functions are equivalent to running the native JavaScript array functions on the underlying array, and then notifying listeners about the change: push( value ) — Adds a new item to the end of array. pop() — Removes the last value from the array and returns