Search in sources :

Example 11 with Converter

use of org.sql2o.converters.Converter 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 Converter

use of org.sql2o.converters.Converter 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

Converter (org.sql2o.converters.Converter)12 HashMap (java.util.HashMap)7 Bean (org.springframework.context.annotation.Bean)7 Sql2o (org.sql2o.Sql2o)7 NoQuirks (org.sql2o.quirks.NoQuirks)7 InstantConverter (net.runelite.http.service.util.InstantConverter)6 ConverterException (org.sql2o.converters.ConverterException)5 DataSource (javax.sql.DataSource)3 Sql2oException (org.sql2o.Sql2oException)2 Getter (org.sql2o.reflection.Getter)2 Pojo (org.sql2o.reflection.Pojo)2 Setter (org.sql2o.reflection.Setter)2 ResultSet (java.sql.ResultSet)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1