gruppen und likes fertig

This commit is contained in:
PaulK 2025-02-14 11:39:39 +01:00
parent fdd18bdb6c
commit fce585e089
3 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import java.time.LocalDateTime;
@Entity @Entity
@Table(name = "`like`") @Table(name = "`likes`")
public class Like { public class Like {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@ -11,6 +11,7 @@ public interface RecipeRepository extends JpaRepository<Recipe, Long> {
Page<Recipe> findByCategoryIgnoreCase(String category, Pageable pageable); Page<Recipe> findByCategoryIgnoreCase(String category, Pageable pageable);
// Sucht nach Rezepten, die eine bestimmte Zutat enthalten // Sucht nach Rezepten, die eine bestimmte Zutat enthalten
@Query("SELECT r FROM Recipe r JOIN r.recipeIngredients i WHERE LOWER(i.name) LIKE LOWER(CONCAT('%', :ingredient, '%'))") @Query("SELECT r FROM Recipe r JOIN r.recipeIngredients i WHERE LOWER(i.ingredient.name) LIKE LOWER(CONCAT('%', :ingredient, '%'))")
Page<Recipe> findByIngredient(@Param("ingredient") String ingredient, Pageable pageable); Page<Recipe> findByIngredient(@Param("ingredient") String ingredient, Pageable pageable);
} }

View File

@ -4,6 +4,9 @@ spring.datasource.username=root
spring.datasource.password= spring.datasource.password=
# Hibernate Einstellungen # Hibernate Einstellungen
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.hibernate.ddl-auto=update