Here is my model:
@Entity(name = "checkinusers")
public class User {
@Id
@JsonIgnore
@ApiModelProperty(hidden = true)
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false, columnDefinition = "INT(1)")
private long userId;
@Column(name = "username", nullable = false)
private String username;
@Column(name = "password", nullable = false, columnDefinition = "TEXT")
private String password;
@Column(name = "salt", nullable = false, columnDefinition = "TEXT")
private String salt;
@ApiModelProperty(hidden = true)
@Column(name = "lastlogin", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private Date created;
Here is the method:
@Modifying
@Transactional
@Query("UPDATE User u SET u.created ='0000-00-00 00:00:00' WHERE u.username = :username ")
void updateLastLogin(@Param("username") String username);
This is the error I get when I try to start spring application
Failed to execute goal
org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:run(default-cli) on project licenta: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract void com.example.licenta.service.UserService.update(java.lang.String)! org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [UPDATE User u SET u.created ='0000-00-00 00:00:00' WHERE u.username = :user name ]