[Seasar-user:17086] [dbflute] 2 WAY SQLのリテラルが、そのまま SQLに出てしまう

Masanobu Shimura [E-MAIL ADDRESS DELETED]
2009年 3月 20日 (金) 18:01:15 JST


久保さん
はまってしまったので、教えて下さい。

なお SQL文を下記に修正すれば通りますので、急いではいませんが。

また /*IF にしても同様で、変化ありません。

dbflute runtime 0.9.3、S2 2.4.33 で、 dbflute-basic-exampleは、ERRORなく通ります。

志村


通る SQL文

   WHERE
user_role.loginname =  /*pmb.loginname*/
   AND transaction_screen.screen =   /*pmb.screen*/


ERROR 外だし SQL文

-- !SelectLevelPmb!
-- !!String loginname!!
-- !!String screen!!
SELECT
        MAX(LEVEL)
    FROM
        transaction_screen
            JOIN tran_role
                ON transaction_screen.transaction = tran_role.transaction
            JOIN user_role
                ON user_role.role = tran_role.role
    WHERE
user_role.loginname =  /*pmb.loginname*/    'mike'
   AND transaction_screen.screen =   /*pmb.screen*/     '/example/vdr'

実行LOG

DEBUG 2009-03-20 17:39:44,519 [main] 論理的なコネクションを取得しました。tx=[FormatId=4360,
GlobalId=1237538384068/0, BranchId=]
DEBUG 2009-03-20 17:39:44,529 [main]
-- !SelectLevelPmb!
-- !!String loginname!!
-- !!String screen!!
SELECT
        MAX(LEVEL)
    FROM
        transaction_screen
            JOIN tran_role
                ON transaction_screen.transaction = tran_role.transaction
            JOIN user_role
                ON user_role.role = tran_role.role
    WHERE
user_role.loginname =  'mike'    'mike'
   AND transaction_screen.screen =   '/example/menu'     '/example/vdr'
DEBUG 2009-03-20 17:39:44,627 [main] 論理的なコネクションを閉じました。tx=[FormatId=4360,
GlobalId=1237538384068/0, BranchId=]
DEBUG 2009-03-20 17:39:44,627 [main] END
org.seasar.ef.example.agile.logic.TransactionLogic#GetLevel(mike,
/example/menu) Throwable:org.seasar.dbflute.exception.SQLFailureException:
Look! Read the message below.
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
The SQL failed to execute!

[Advice]
Please confirm the SQLException message.

[SQLState]
42601

[ErrorCode]
0

[SQLException]
org.seasar.framework.exception.SSQLException
[ESSR0072]SQLで例外(SQL=[-- !SelectLevelPmb!
-- !!String loginname!!
-- !!String screen!!
SELECT
        MAX(LEVEL)
    FROM
        transaction_screen
            JOIN tran_role
                ON transaction_screen.transaction = tran_role.transaction
            JOIN user_role
                ON user_role.role = tran_role.role
    WHERE
user_role.loginname =  ?    'mike'
   AND transaction_screen.screen =   ?     '/example/vdr'], Message=[0],
ErrorCode=42601, SQLState={3})が発生しました

[NextException]
org.postgresql.util.PSQLException
ERROR: syntax error at or near "'mike'"

[Behavior]
TranRoleBhv.outsideSql().selectList()

[OutsideSql]
org/seasar/ef/example/agile/dbflute/exbhv/TranRoleBhv_selectLevel.sql

[ParameterBean]
org.seasar.ef.example.agile.dbflute.exbhv.pmbean.SelectLevelPmb
{mike,/example/menu}

[Statement]
org.seasar.extension.jdbc.impl.PreparedStatementWrapper

[Display SQL]
-- !SelectLevelPmb!
-- !!String loginname!!
-- !!String screen!!
SELECT
        MAX(LEVEL)
    FROM
        transaction_screen
            JOIN tran_role
                ON transaction_screen.transaction = tran_role.transaction
            JOIN user_role
                ON user_role.role = tran_role.role
    WHERE
user_role.loginname =  'mike'    'mike'
   AND transaction_screen.screen =   '/example/menu'     '/example/vdr'
* * * * * * * * * */
DEBUG 2009-03-20 17:39:44,640 [main] トランザクションをロールバックしました。tx=[FormatId=4360,
GlobalId=1237538384068/0, BranchId=]
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20090320/74608c66/attachment.html>


Seasar-user メーリングリストの案内