A. Jachs
A. Jachs

Reputation: 47

JPA query with 'And' in the variable name

findAllByBoolVariable1AndBoolAndVariable2AndBoolVariable3

I have a query like this. The entity variable names are boolVariable1, boolAndVariable2 (has an 'And' in its name) and boolVariable3.

I get the error "No property bool found for type ..." on building.

I cannot be removing the 'And' in the variable name.

How can I achieve this?

Upvotes: 1

Views: 919

Answers (2)

SYED MUSTAFA HUSSAIN
SYED MUSTAFA HUSSAIN

Reputation: 481

You can create custom Query with the help of annotation @Query

@Transactional
     @Query("delete from LogicCondition lc where lc.id = :id")
     void deleteById(Integer id);

for like that!

Upvotes: 0

Hard_Coder
Hard_Coder

Reputation: 848

Loook at this examplle:

@Query("select r from EntityName r where r.boolAndVariable2 = :param")
List<EntityName> findByVariable(@Param("param") String param);

You can use @Query annotation and in write your query in it.

Upvotes: 1

Related Questions