Hibernate version: 3.2 GA
Firebird 2.0
While I am certain this is bug, the process does state to post this to the forum for feedback so I am following the process first.
I have found that if I have sql comments turned on the FirebirdDialect generates an incorrect limitString.
The current FirebirdDialect getLimitString looks like the following:
Code:
public String getLimitString(String sql, boolean hasOffset) {
return new StringBuffer( sql.length()+20 )
.append(sql)
.insert(6, hasOffset ? " first ? skip ?" : " first ?")
.toString();
}
Which generates sql like:
Code:
Hibernate:
/* cri first ? skip ?teria query */ select
this_.id as id1_0_,
this_.h_version as h2_1_0_,
this_.name as name1_0_
from
domain_b this_
If I change the method like:
Code:
public String getLimitString(String sql, boolean hasOffset) {
StringBuffer limitBuf = new StringBuffer( sql.length()+20 );
limitBuf.append(sql);
int index = sql.indexOf("select");
if( index < 0 ) index = sql.indexOf("SELECT");
if( hasOffset ) {
limitBuf.insert(index+6, " first ? skip ?");
} else {
limitBuf.insert(index+6, " first ? ");
}
return limitBuf.toString();
}
The output look like:
Code:
Hibernate:
/* criteria query */ select
first ? skip ? this_.id as id1_0_,
this_.h_version as h2_1_0_,
this_.name as name1_0_
from
domain_b this_
I think its a bug - comments?