0

Wondering if you could help me out.

I am needing a bit of help using HQL. I currently have two tables, car and carStatus. The car table stores info such as make, model, year etc. The carStatus table contains information on the status of the car, ie crashed, fixed, unfixable etc. In java I have the two tables car and carStatus. Car has a 1 to many relationship with carStatus. What I want to do, using hql is get a list of all the cars where they do not have a carStatus of “crashed”. Is this possible and how would I go about it using hql if it is? The format I am using for HQL is that I have a carRepository which extends springs CrudRepository.

  @Query(“FROM car c WHERE …)
  Car carNotCrashed;

Any help would be greatly appreciated.

J145
  • 607
  • 1
  • 11
  • 16

1 Answers1

0

This might help You

"From Car car left join CarStatus status where status.status != 'Crashed'"

Animesh Agrawal
  • 161
  • 2
  • 16
  • Thanks but this doesnt help, it still returns all the rows that have different status's, if there is no row with the value of crashed on the carStatus table I dont want anything returned. Thanks for trying anyway. – J145 May 21 '15 at 12:02
  • did you checked status value in Db what is stored 'Crashed' Or 'crashed'.. did you noticed that – Animesh Agrawal May 21 '15 at 12:17