问题是我在使用@RepositoryRestResource我的UserRepository扩展时遇到了异常JpaRepository。
原因是默认情况下findById只接受Long或输入Int,即使我有
@Id String id;而不是@Id Int id在我的实体定义中。
我尝试搜索 StackOverflow 和 Google,但没有找到任何解决方案。
错误信息如下:
"Failed to convert from type [java.lang.String] to type [java.lang.Integer] for value '3175433272470683'; nested exception is java.lang.NumberFormatException: For input string: \"3175433272470683\""
我想让它与
@Id String id;
有什么建议?
非常感谢提前。在这里提问是我的荣幸。
实体类:
@Entity // This tells Hibernate to make a table out of this class
@Table(name = "users")
public class XmppUser {
@Id
private java.lang.String username;
private String …Run Code Online (Sandbox Code Playgroud)