Skip to content

🔥 Welcome to RaveSQL

Welcome, fellow hardcore ravers, to the RaveSQL universe! Here, SQL queries and database updates drop like the sickest beats in a non-stop rave, keeping your app’s data in sync with the high-energy BPM of speedcore.

Why RaveSQL?

  • Streamline Database Interactions: Link your Java methods to SQL scripts seamlessly, reducing boilerplate and enhancing maintainability.
  • Automatic Result Mapping: Automatically map SQL query results to your Java objects, making data handling as smooth as your favorite beats.
  • Comprehensive Querying & Updating: Access a wide range of methods for querying and updating, ensuring all your data needs are met with high-energy efficiency.
  • Enhance Performance: Utilize SQL caching for rapid query access, ensuring your application runs smoothly without missing a beat.
  • Reliable Error Handling: Custom exceptions keep your data rave secure by managing errors gracefully.

Hardcore Never Dies! âš¡


Drop the Bass with Maven


1. Add the RaveSQL Dependency

Just like adding the hottest track to your rave playlist, include RaveSQL in your pom.xml to keep the party going:

<dependency>
<groupId>com.ravesql</groupId>
<artifactId>ravesql</artifactId>
<version>1.0.0</version>
</dependency>

2. Import RaveSQL into Your Project

Bring in the RaveSQL vibes by importing the necessary classes into your Java files:

import com.ravesql.RaveRepository;
import com.ravesql.annotation.SqlPath;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

3. Inject RaveRepository with Spring’s Autowire

Let RaveRepository be the DJ that mixes your data seamlessly. Inject it into your service class using Spring’s @Autowired or constructor injection:

@Repository
public class PartyRepository {
private final RaveRepository raveRepository;
@Autowired
public PartyRepository(RaveRepository raveRepository) {
this.raveRepository = raveRepository;
}
@SqlPath("sql/getPartyTracksByGenre.sql")
public List<Track> getPartyTracks(String genre) {
return raveRepository.query(Track.class, "genre", genre);
}
}

✨ Pro Tip: Use the @SqlPath annotation to link your methods to their SQL scripts, ensuring every query hits the dancefloor with precision!


Gradle Integration: Spin Those Beats with build.gradle


1. Add the RaveSQL Dependency

Inject some hardcore energy into your build.gradle by adding RaveSQL to your dependencies:

dependencies {
implementation 'com.ravesql:ravesql:1.0.0'
}

2. Import RaveSQL into Your Project

Sync your project’s rhythm by importing RaveSQL classes:

import com.ravesql.RaveRepository;
import com.ravesql.annotation.SqlPath;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

3. Inject RaveRepository with Spring’s Autowire

Let RaveRepository handle your data flows like a speedcore beat. Inject it into your service class:

@Repository
public class BeatRepository {
private final RaveRepository raveRepository;
@Autowired
public BeatRepository(RaveRepository raveRepository) {
this.raveRepository = raveRepository;
}
@SqlPath("sql/getBeatDetails.sql")
public BeatDetails getBeatDetails(int beatId) {
return raveRepository.queryForObject(BeatDetails.class, "id", beatId);
}
}

✨ Pro Tip: Keep your SQL scripts ready and let @SqlPath guide your methods to execute queries without missing a beat!


Example Usage: Keep the Data Flowing Like a Non-Stop Rave

Here’s how you can harness the power of RaveSQL in your application:

@Repository
public class TrackRepository {
private final RaveRepository raveRepository;
@Autowired
public TrackRepository(RaveRepository raveRepository) {
this.raveRepository = raveRepository;
}
@SqlPath("sql/getTracks.sql")
public List<DanceMove> getTracksByStyle(String style) {
return raveRepository.query(Tracks.class, "style", style);
}
@SqlPath("sql/insertTrack.sql")
public int addTrack(Track track) {
return raveRepository.update(track);
}
@SqlPath("sql/updateTrack.sql")
public int update(int bpm) {
return raveRepository.update("bpm", bpm);
}
@SqlPath("sql/deleteTrack.sql")
public int deleteTrack(int trackId) {
return raveRepository.update("trackId", trackId);
}
}

Preload Your SQL Tracks

Before the rave starts, preload your SQL queries to ensure everything runs smoothly:

@Component
public class RaveInitializer {
private final RaveRepository raveRepository;
@Autowired
public RaveInitializer(RaveRepository raveRepository) {
this.raveRepository = raveRepository;
preloadQueries();
}
private void preloadQueries() {
raveRepository.preloadSqlQueries(List.of(
"sql/getTracks.sql",
"sql/insertTrack.sql",
"sql/updateTrack.sql",
"sql/deleteTrack.sql"
));
}
}

Clear the SQL Cache When Needed

Need to refresh the playlist? Clear the SQL cache effortlessly:

public void refreshPlaylist() {
raveRepository.clearSqlCache();
preloadQueries();
}

Final Drop: Let RaveSQL Keep Your Data Raving!

With RaveSQL, your application’s data interactions will never miss a beat. Whether you’re building a high-energy party planner or a nonstop dance track manager, RaveSQL ensures your SQL queries are always in sync with the pulsating rhythm of your application.

So, gear up, integrate RaveSQL, and let your data rave to the hardcore, gabber, and speedcore vibes!


Stay Hardcore, Keep Raving! 🖤