mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2710 - JSONB fields are not considered dirty after modified in BeanPersistController preUpdate
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package org.tests.model.basic;
|
||||
|
||||
import io.ebean.Model;
|
||||
import io.ebean.annotation.DbJsonB;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,12 +22,31 @@ public class UTMaster extends Model {
|
||||
|
||||
LocalDate eventDate;
|
||||
|
||||
@DbJsonB
|
||||
Journal journal;
|
||||
|
||||
@Version
|
||||
Integer version;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
List<UTDetail> details;
|
||||
|
||||
/**
|
||||
* Mutating content persisted as JSON.
|
||||
*/
|
||||
public static class Journal {
|
||||
private List<String> entries = new ArrayList<>();
|
||||
public List<String> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
public void setEntries(List<String> entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
public void addEntry() {
|
||||
entries.add(LocalDateTime.now().toString());
|
||||
}
|
||||
}
|
||||
|
||||
public UTMaster() {
|
||||
|
||||
}
|
||||
@@ -74,6 +95,14 @@ public class UTMaster extends Model {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Journal getJournal() {
|
||||
return journal;
|
||||
}
|
||||
|
||||
public void setJournal(Journal journal) {
|
||||
this.journal = journal;
|
||||
}
|
||||
|
||||
public List<UTDetail> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user