I don't understand why is my JPQL expression wrong. I want to get the list with bikes that are not deleted from my database and is renting at the moment. Can you help me?
@Data
@MappedSuperclass
public abstract class AbstractEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Basic(optional = false)
@Column(nullable = false)
private boolean isRemoved;
}
@Data
@Entity
@NamedQueries({
@NamedQuery(name = "Bike.findRent", query = "SELECT b FROM Bike b WHERE NOT b.isRemoved AND b.isRent")
})
public class Bike extends AbstractEntity {
@Basic(optional = false)
@Column(nullable = false)
private boolean isRent;
}
@Repository
public class BikeDao extends BaseDao<Bike> {
public BikeDao() {
super(Bike.class);
}
public List<Bike> findRent() {
return em.createNamedQuery("Bike.findRent", Bike.class).getResultList();
}
}
And after I run my Spring app and through Postman try to post Bike data. But,
Caused by: org.eclipse.persistence.exceptions.EntityManagerSetupException:
Exception Description: Deployment of PersistenceUnit [default] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.7.7.v20200504-69f2c2b80d): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing [SELECT b FROM Bike b WHERE NOT b.isRemoved AND b.isRent].
[47, 55] The right expression is not a valid expression.
What does it mean? I cannot found out what is wrong.