Search in sources :

Example 11 with NoQuirks

use of org.sql2o.quirks.NoQuirks in project runelite by runelite.

the class SpringBootWebApplication method sql2o.

@Bean("Runelite SQL2O")
Sql2o sql2o() throws NamingException {
    DataSource dataSource = (DataSource) getContext().lookup("jdbc/runelite");
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o(dataSource, new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) InstantConverter(net.runelite.http.service.util.InstantConverter) Converter(org.sql2o.converters.Converter) InstantConverter(net.runelite.http.service.util.InstantConverter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) DataSource(javax.sql.DataSource) Bean(org.springframework.context.annotation.Bean)

Example 12 with NoQuirks

use of org.sql2o.quirks.NoQuirks in project runelite by runelite.

the class CacheConfiguration method sql2o.

@Bean
@Qualifier("Runelite Cache SQL2O")
public Sql2o sql2o(DataSource dataSource) {
    Map<Class, Converter> converters = new HashMap<>();
    converters.put(Instant.class, new InstantConverter());
    return new Sql2o(dataSource, new NoQuirks(converters));
}
Also used : HashMap(java.util.HashMap) Converter(org.sql2o.converters.Converter) NoQuirks(org.sql2o.quirks.NoQuirks) Sql2o(org.sql2o.Sql2o) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Aggregations

NoQuirks (org.sql2o.quirks.NoQuirks)12 HashMap (java.util.HashMap)8 Sql2o (org.sql2o.Sql2o)8 Bean (org.springframework.context.annotation.Bean)7 Converter (org.sql2o.converters.Converter)7 DataSource (javax.sql.DataSource)6 InstantConverter (net.runelite.http.service.util.InstantConverter)6 Connection (java.sql.Connection)3 Test (org.junit.Test)2 Before (org.junit.Before)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1 Connection (org.sql2o.Connection)1 DateTimeConverter (org.sql2o.converters.joda.DateTimeConverter)1 Quirks (org.sql2o.quirks.Quirks)1