I have Item class and Category class. Item class has a reference to the Category class. 

Item Class is as follows.

```
@Entity
@Table(name = "ITEMS")
public class Item {

@OneToOne
private Category category;
    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }
}

```

Category Class is as follows.

```
package com.easypos.models;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

@Entity
@Table(name="category")
public class Category implements Serializable{

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE)
    private int id;
    @Size(min = 2, max = 30)
    @Column(name = "CATEGORY_NAME", nullable = false)
    private String categoryName;
    @Column(name = "CATEGORY_REMARK", nullable = true)
    private String categoryDescription;

    public int getId() {
        return id;
    }

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

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName.trim();
    }

    public String getCategoryDescription() {
        return categoryDescription;
    }

    public void setCategoryDescription(String categoryDescription) {
        this.categoryDescription = categoryDescription;
    }

    @Override
    public String toString() {
        return this.categoryName;
    }

}

```

My controller methods are as follows

```
@RequestMapping(value = "/add", method = RequestMethod.GET)
    public String create(Model model) {
        item = new Item();
        model.addAttribute("title", "Add Item");
        model.addAttribute("categories", categoryService.findAll());
        model.addAttribute("suppliers", supplierService.findAll());
        model.addAttribute(item);
        return "item/create";
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String savePorduct(Model model, @ModelAttribute("item") @Valid Item item, BindingResult result,
            RedirectAttributes redirectAttributes) {
        itemValidator.validate(item, result);
        if (result.hasErrors()) {
            model.addAttribute("title", "Add Item");
            model.addAttribute("categories", categoryService.findAll());
            model.addAttribute("suppliers", supplierService.findAll());
            return "item/create";
        }
        redirectAttributes.addFlashAttribute("message", "Item successfully saved.");
        itemService.saveitem(item);
        return "redirect:/item/";
    }

```

In My `Jsp` file i have used the following code to show the categories in a select box.

 has-error ">
 Category

`<div class="col-sm-9">
 <sf:select path="category" cssClass="form-control">
 <sf:options items='${categories}' itemValue='id'/>
 </sf:select>
 <p><sf:errors path="category" /></p>
 </div>
 </div>`

In My `Jsp` file when I submit the form I get the error which says "no matching editors or conversion strategy found" - the full error log is as follows:

```
Failed to convert property value of type [java.lang.String] to required type [com.easypos.models.Category] for property category; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.easypos.models.Category] for property category: no matching editors or conversion strategy found

```