我最近更新到spring sts 4,所以我不确定是否有什么原因导致此问题,因为我之前没有这个错误。
我已经确保从数据库中获取的用户对象是User对象,并且应该传递给下一行代码
错误消息
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]
WEBFLOW
<evaluate result="user" expression="usersService.getCustomerById(1)"></evaluate>
<evaluate expression="order.users = flowScope.user"></evaluate>
USERSS
@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;
我尝试将结果指定为流量计或任何其他类型的variabel,但没有任何效果。该错误也非常令人困惑,因为它是同一类型,只是带有注释。也许它与webflow配置有关,因为我在其他任何地方都没有收到此错误。如上所述,我刚刚更新到sts 4,因此即时通讯要回到版本3,看看是否就是问题所在。任何帮助将不胜感激。
答案 0 :(得分:0)
该错误是由pom.xml中的spring开发工具引起的。从我的代码中删除它后,它开始工作。不确定为什么会这样。