我有一个包含字符串的文本文件
<><> name: idontknow <><><> dob: <>
Run Code Online (Sandbox Code Playgroud)
我想只得到字符串名称和dob,但正则表达式我得到<> name和<> <> dob.
我使用的正则表达式是
(?<=>).*?(?=:)
Run Code Online (Sandbox Code Playgroud)
任何建议都会有很大的帮助.
我有 2 个对象和地址。人是父母,地址是孩子。
我的存储库正在扩展 JPARepository。
personRepository.save(person);
插入工作正常。但是当我通过更新两个表中的状态(例如:Active)并使用personRepository.save(person);我的外键引用(person_fk)来更新人员对象时,它被设置为空。
我的父类:
@Entity
@DynamicUpdate
@Table(name = "person")
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="person_pk", nullable=false)
private Long personPK;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "person",cascade = CascadeType.PERSIST)
private Set<Address> addresses = new HashSet<>();
...
}
Run Code Online (Sandbox Code Playgroud)
还有我的孩子班:
@Entity
@DynamicUpdate
@Table(name = "address")
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "address_pk")
private Long addressPK;
@ManyToOne
@JoinColumn(name = "person_fk", referencedColumnName = "person_pk", nullable=false)
private Address …Run Code Online (Sandbox Code Playgroud)