hibernate

Java 模拟servlet执行、DTD约束、Schema约束、dom4j解析

旧城冷巷雨未停 提交于 2020-12-28 08:20:09
模拟servlet执行 浏览器请求WEB服务器上的资源,WEB服务器返回给浏览器 浏览器的入口不同(访问路径),访问的资源也不同。 我们需要使用xml约束(DTD或schema);为了获得xml的内容,我们需要使用dom4j进行解析。 XML(不同路径(/hello)执行不同的资源( HeIIoMyServlet)) XML可扩展的标记语言 标签可自定义的 包下创建xml 文件 new → other → XMLFile 粘贴web-app_ 2_ 3.dtd文件 复制web-app_ 2_ 3.dtd的文档声明到xml文件 存放数据 <?xml version="1.0" encoding="UTF-8"?> XML文档声明第一行 顶格写 versioin:XML版本encoding:文档的编码 默认utf-8: //加入Java开发交流君样:756584822一起吹水聊天 <school name="oracle" size="3"> 元素(不以XML,xml开头)一个根元素 <person> 属性值必须使用单引或双引 <name>张三<</name> 元素内容 转义符 写法与html相同 <age><![CDATA[18><]]></age>CDATA区<![CDATA[内容自动转义]]> <c/> 空元素 </person> <!--注释--> </school>

How to fix “Error executing DDL ”alter table events drop foreign key FKg0mkvgsqn8584qoql6a2rxheq“ via JDBC Statement”

烂漫一生 提交于 2020-12-28 07:00:30
问题 I'm trying to start spring boot project with MySQL database, but I have some problem with database. I try to start my application that, and server is running but hibernate don't create Tables etc. This is my code: User Entity @Entity public class User { @Id @GeneratedValue(strategy = IDENTITY) private Long id; private String firstName; private String lastName; private String email; private String password; private String description; private String profile_photo; private LocalDate create;

How do you handle with bulk deleting by an array of IDs in Spring Data JPA?

折月煮酒 提交于 2020-12-28 06:59:47
问题 Now I have a class User, I get a request data of an array from the jsp or html . list this Integer[] arr=[5,6,9,10,62,52,21] and then I use two methods to finish bulking deleting action. @Transactional @Override public void deleteUser(Integer id) { oneRepository.delete(id); } @Transactional @Override public void deleteSomeUser(Integer[] ids) { for (Integer id : ids) { deleteUser(id); } } I want to know that if it's a more efficient method to finish this action. you can see my logs: it seems

How do you handle with bulk deleting by an array of IDs in Spring Data JPA?

别说谁变了你拦得住时间么 提交于 2020-12-28 06:56:40
问题 Now I have a class User, I get a request data of an array from the jsp or html . list this Integer[] arr=[5,6,9,10,62,52,21] and then I use two methods to finish bulking deleting action. @Transactional @Override public void deleteUser(Integer id) { oneRepository.delete(id); } @Transactional @Override public void deleteSomeUser(Integer[] ids) { for (Integer id : ids) { deleteUser(id); } } I want to know that if it's a more efficient method to finish this action. you can see my logs: it seems

How do you handle with bulk deleting by an array of IDs in Spring Data JPA?

青春壹個敷衍的年華 提交于 2020-12-28 06:54:06
问题 Now I have a class User, I get a request data of an array from the jsp or html . list this Integer[] arr=[5,6,9,10,62,52,21] and then I use two methods to finish bulking deleting action. @Transactional @Override public void deleteUser(Integer id) { oneRepository.delete(id); } @Transactional @Override public void deleteSomeUser(Integer[] ids) { for (Integer id : ids) { deleteUser(id); } } I want to know that if it's a more efficient method to finish this action. you can see my logs: it seems

foreign key must have same number of columns as the referenced primary key for manytoone mapping

两盒软妹~` 提交于 2020-12-27 04:05:21
问题 Hi below is my entities with manytoone association between them student.java @Entity @Table(name = "student") public class student{ @Id @Column(name = "UserID") private String userid; @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn(name = "userrole", referencedColumnName = "VALUE"), @JoinColumn(name = "userrole", referencedColumnName = "DESCRIPTION") }) private studentdetails userrole; //setters and getters //constructor } studentdetails.java @Data

foreign key must have same number of columns as the referenced primary key for manytoone mapping

*爱你&永不变心* 提交于 2020-12-27 04:01:31
问题 Hi below is my entities with manytoone association between them student.java @Entity @Table(name = "student") public class student{ @Id @Column(name = "UserID") private String userid; @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn(name = "userrole", referencedColumnName = "VALUE"), @JoinColumn(name = "userrole", referencedColumnName = "DESCRIPTION") }) private studentdetails userrole; //setters and getters //constructor } studentdetails.java @Data

foreign key must have same number of columns as the referenced primary key for manytoone mapping

无人久伴 提交于 2020-12-27 03:59:42
问题 Hi below is my entities with manytoone association between them student.java @Entity @Table(name = "student") public class student{ @Id @Column(name = "UserID") private String userid; @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn(name = "userrole", referencedColumnName = "VALUE"), @JoinColumn(name = "userrole", referencedColumnName = "DESCRIPTION") }) private studentdetails userrole; //setters and getters //constructor } studentdetails.java @Data

Spring框架

末鹿安然 提交于 2020-12-27 00:25:02
Spring框架自2002年诞生以来一直备受开发者青睐,它包括SpringMVC、SpringBoot、Spring Cloud、Spring Cloud Dataflow等解决方案。有人亲切的称之为:Spring 全家桶。 很多研发人员把spring看作心目中最好的java项目,没有之一。所以这是重点也是难点,工作中必须会,面试时肯定考。 那么,不妨花费10分钟,梳理Spring框架相关知识。 Spring知识点-汇总 spring系列包含非常多的项目,可以满足java开发中的方方面面。 先来看常用框架的知识点汇总,如图: 一、5个常用的spring框架 ▌1.spring framework 也就是我们经常说的spring框架,包括了ioc依赖注入,Context上下文、bean管理、springmvc等众多功能模块,其它spring项目比如spring boot也会依赖spring框架。 ▌2.spring boot 它的目标是简化Spring应用和服务的创建、开发与部署,简化了配置文件,使用嵌入式web服务器,含有诸多开箱即用的微服务功能,可以和spring cloud联合部署。 Spring Boot的核心思想是约定大于配置,应用只需要很少的配置即可,简化了应用开发模式。 ▌3.Spring Data 是一个数据访问及操作的工具集,封装了多种数据源的操作能力,包括

“ConcurrentModificationException” when updating my entities

≡放荡痞女 提交于 2020-12-26 12:13:48
问题 Problem Im using hibernate 5.4.11 core and when i try to update large amounts of entities i run into that issue right here. It looks like an hibernate internal exception. Update I tested it with hibernate 5.4.23, the same exception occured. I also updated my "mysql connector" to the latest version "8.0.22" and it didnt worked either, the same exception. Describtion This is how i update my entities, it runs in another thread, which should not be the problem here... its basically a own thread