Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

NPE when trying to override result in QuerySQLSyntaxProvider

12 views
Skip to first unread message

Nikita Pedorich

unread,
Jan 5, 2019, 2:49:38 PM1/5/19
to ScalikeJDBC Users Group
Hi there! 
So I'm trying to slightly modify ScalikeJDBC because I need to use it with Apache Phoenix which requires column names and sometime table names be wrapped in double quotes. So right now I'm trying to extend QuerySQLSyntaxProvider and override result field so it can return something like `C."key" as k_on_C` and I got this weird behavior  when I get NullPointerException when I'm trying to override this val. Even if I didn't change behavior and just coped exact code from the library. The exception itself happens at `scalikejdbc.SQLSyntaxSupportFeature$QuerySQLSyntaxProvider.<init>(SQLSyntaxSupportFeature.scala:492)` on this line there is `val resultName: BasicResultNameSQLSyntaxProvider[S, A] = result.nameProvider`. I also tried manually override `resultName` in QuerySQLSyntaxProvider. I'm attaching runnable example, you don't need any actual DB connection settings. I can't understand what's wrong here.
ScalikeJDBCTest.scala

Kazuhiro Sera

unread,
Jan 6, 2019, 4:44:06 PM1/6/19
to Nikita Pedorich, ScalikeJDBC Users Group
hmm. I don't have any good ideas about your issue. If you really need
to enhance SQL interpolation, modifying the library code to have
necessary changes may be the straightforward solution.

On Sun, Jan 6, 2019 at 4:49 AM Nikita Pedorich <gmx...@gmail.com> wrote:
>
> Hi there!
> So I'm trying to slightly modify ScalikeJDBC because I need to use it with Apache Phoenix which requires column names and sometime table names be wrapped in double quotes. So right now I'm trying to extend QuerySQLSyntaxProvider and override result field so it can return something like `C."key" as k_on_C` and I got this weird behavior when I get NullPointerException when I'm trying to override this val. Even if I didn't change behavior and just coped exact code from the library. The exception itself happens at `scalikejdbc.SQLSyntaxSupportFeature$QuerySQLSyntaxProvider.<init>(SQLSyntaxSupportFeature.scala:492)` on this line there is `val resultName: BasicResultNameSQLSyntaxProvider[S, A] = result.nameProvider`. I also tried manually override `resultName` in QuerySQLSyntaxProvider. I'm attaching runnable example, you don't need any actual DB connection settings. I can't understand what's wrong here.
>
> --
> You received this message because you are subscribed to the Google Groups "ScalikeJDBC Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scalikejdbc-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages