如何在Activiti中使用变量启动进程?

时间:2019-04-20 08:43:31

标签: java spring activiti

我尝试使用Person对象(“ Person是抽象的, RealPerson扩展Person,并且我将RealPerson传递给此方法)  :

    public void startProcess(Person person) {
        Map<String, Object> map = new HashMap<>();
        map.put("person", person);
        runtimeService.startProcessInstanceByKey("core",map);
}

但是我明白了:

  

org.activiti.engine.ActivitiException:无法序列化值   变量中的“ ir.enbank.core.model.entitiy.RealPerson@725e40ee”   “人”

我该怎么做?

更新:

@Entity
@EntityListeners(AuditingEntityListener.class)
public abstract class Person implements Serializable {
    @Id
    @GeneratedValue
    private Integer id;
    @Version
    private Integer version;
    @NotNull
    private String name;
    @NotNull
    private String family;
    @NotNull
    private Date date;
    @NotNull
    private Sex sex;
    @OneToMany(cascade = CascadeType.ALL,orphanRemoval = true)
    private List<Deposit> deposit;
    @OneToMany(cascade = CascadeType.ALL,orphanRemoval = true)
    private List<Phone> phones;
    @NotNull
    private String address;

    public Person() {
    }

    public List<Deposit> getDeposit() {
        return deposit;
    }

    public void setDeposit(List<Deposit> deposit) {
        this.deposit = deposit;
    }

    public String getAddress() {

        return address;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Sex getSex() {
        return sex;
    }

    public void setSex(Sex sex) {
        this.sex = sex;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFamily() {
        return family;
    }

    public void setFamily(String family) {
        this.family = family;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }


    public List<Phone> getPhones() {
        return phones;
    }

    public void setPhones(List<Phone> phones) {
        this.phones = phones;
    }

}

更新2:

@Entity
public class RealPerson extends Person {
    @NotNull
    private String email;
    @RecognizerCode
private Integer nationalCode;


    public Integer getNationalCode() {
        return nationalCode;
    }

    public void setNationalCode(Integer nationalCode) {
        this.nationalCode = nationalCode;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }




}

0 个答案:

没有答案