I'm having an Item class with a property named vendor_name as below:
@Entity
@Table(name="item_info")
public class Item {
@Column(name="vendor_name")
protected String vendor_name;
/* Getter/Setter methods */
I'm trying to write a CRUDRepository interface to return Items based on vendor_name:
@Repository
public interface ItemDAO extends CrudRepository<Item, Integer>{
public Item findByVendor__name(@Param("vendor_name") String vendor_name);
}
According to the docs, if there is an underscore in the property name,then we need to escape the underscore in the findBy method by adding an additional underscore. However, I'm still getting an error saying "no property named vendor found for type Item".
I cannot remove the underscore from the property. Is there any other way to solve this?
Aucun commentaire:
Enregistrer un commentaire