Skip to content

👽 The Core Annotation: @SqlPath


Overview

@SqlPath is your backstage pass, linking your Java methods to their SQL scripts. Just like a DJ synchronizes tracks to maintain the rave’s vibe, @SqlPath ensures your SQL queries are always in sync with your application’s data flow.

Usage

import com.ravesql.annotations.SqlPath;
public class TrackService {
@SqlPath("sql/getTracksByBPM.sql")
public List<Track> getTracksByBPM(int bpm) {
// Method implementation
}
}

Parameters

  • value: The relative path to your SQL file. Think of it as the playlist that keeps the rave alive.

Example

Imagine you’re spinning a set list for a gabber night. Each method in your service class corresponds to a specific SQL script that fetches or manipulates data:

@SqlPath("sql/bringTheHardcore.sql")
public List<Track> bringTheHardcore();