【发布时间】:2019-08-13 18:52:51
【问题描述】:
我最近更新到 spring sts 4,所以我不确定是否有什么东西导致了这个问题,因为我之前没有这个错误。
我已经确保从数据库中获取的用户对象是一个用户对象并且应该被传递到下一行代码
错误信息
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type
[com.paphos.pos.users.Users] to type [@javax.persistence.ManyToOne @javax.persistence.JoinColumn com.paphos.pos.users.Users]
网络流
<evaluate result="user" expression="usersService.getCustomerById(1)"></evaluate>
<evaluate expression="order.users = flowScope.user"></evaluate>
用户名
@Entity
@Table(name = "users")
@StaticMetamodel(Users.class)
public class Users implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int idusers;
private String username;
private String password;
private int enabled = 0;
private String authority;
@Size(max = 25)
private String name;
@Size(min = 10, max = 10)
private String phoneNo;
@Size(min = 10, max = 10)
private String loyalty;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
private List<Timecard> timecard = new ArrayList<>();
订单
@Entity(name="orders")
public class Orders implements Serializable {
private static final long serialVersionUID = -8538332203504273656L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int idorders;
@ManyToOne
@JoinColumn(name = "idusers")
private Users users;
@ManyToOne
@JoinColumn(name = "createdBy")
private Users createdBy;
@ManyToOne
@JoinColumn(name = "driver")
private Users driver;
@ManyToOne(cascade = { CascadeType.ALL })
@JoinColumn(name = "idaddresses")
private Addresses addresses;
private double pretax;
private double tax;
private double total;
@ManyToOne
@JoinColumn(name = "idstatus")
private Status status;
private String timeOrdered;
private int discounted;
private int tipped;
private Double due;
@OrderColumn
@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.REMOVE }, mappedBy = "orders")
private Set<Orderitem> orderitem;
private double disAmount;
private double tipAmount;
private int paid;
我尝试将结果指定为 flowscope 或任何其他类型的变量,但没有任何效果。该错误也非常令人困惑,因为它是相同的类型,只是上面有注释。也许它与 webflow 配置有关,因为我在其他任何地方都没有收到此错误。如上所述,我刚刚更新到 sts 4,所以我要回到版本 3,看看是否是问题所在。任何帮助将不胜感激。
【问题讨论】:
标签: spring hibernate spring-webflow