Javascript 常用命令
生成UUID
const id = window.crypto.randomUUID()
console.log(id)
// bd4d099b-3d39-4aad-a59c-c45dfac8eaf0
https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
生成UUID
const id = window.crypto.randomUUID()
console.log(id)
// bd4d099b-3d39-4aad-a59c-c45dfac8eaf0
https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
按年月日与消息内容的格式显示相关提交记录,通过--grep筛选
git log --pretty=format:"%cd %s" --grep="筛选消息内容"
在JPA的@OneToOne
(一对一)及@OneToMany
(一对多)有一个orphanRemoval
属性。
例如一個作者(Author)有多本书籍著作(Book),则在Author
类别中会有Book
的集合:
Author.java
public class Author {
...
@OneToMany(mappedBy="author", orphanRemoval=true)
private Set<Book> bookSet;
// getters and setters ommitted
}
Book.java
public class Book {
...
@ManyToOne
private Author author;
// getters and setters ommitted
}
orphanRemoval
预设值为false。若设为true,则当Author物件中的一本book
从bookSet
移除時,资料库Book
资料表的该本书的列会被删除。
orphan代表孤儿,orphanRemoval=true
的意思就是child沒有parent时会被删除。
而和CascadeType.REMOVE
不同的是,CascadeType.REMOVE
是当Authur
物件从资料表中删除時,其所关联的child,也就是所属的bookSet
中的每一个Book
也会从资料表被一并删除。
https://matthung0807.blogspot.com/2018/06/jpa-onetoone-onetomanyorphanremoval.html
局部 {M2_HOME}/conf/settings.xml
全局 ~/.m2/settings.xml
<settings>
<proxies>
<proxy>
<id>httpproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>your-proxy-host</host>
<port>your-proxy-port</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
<proxy>
<id>httpsproxy</id>
<active>true</active>
<protocol>https</protocol>
<host>your-proxy-host</host>
<port>your-proxy-port</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
@Entity
public class Shirt implements Serializable {
@Id
@Size(max=9)
private String id;
@ElementCollection
@CollectionTable(
name = "SHIRT_COLORS",
joinColumns=@JoinColumn(name = "id", referencedColumnName = "id")
)
@Column(name="color")
private List<String> colors = new ArrayList<String>();
...
https://stackoverflow.com/questions/22075199/jpa-elementcollection-list-specify-join-column-name