我最近更新到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>
USERS
@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;
我已经尝试将结果指定为flowcope或任何其他类型的变量,但nothings工作。错误也很混乱,因为它是相同的类型,只有注释。也许它有一些事情要做webflow配置,因为我没有在其他任何地方得到此错误。如上所述,我刚刚更新到第4版,所以我将回到版本3,看看是否是问题。任何帮助,将不胜感激。
这个错误在某种程度上是由spring dev工具在pom.xml中引起的。从我的代码中删除它后,它开始工作。不知道为什么会这样。