You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given following code, jdbi-generator generates correct impl class of JdbiDao interface:
@GenerateSqlObject
public interface JdbiDao extends SqlObject {
@SqlUpdate("insert into users (name) values ( ?)")
@GetGeneratedKeys("id")
long insert(String name);
}
However for:
@GenerateSqlObject
public interface JdbiDao {
@SqlUpdate("insert into users (name) values ( ?)")
@GetGeneratedKeys("id")
long insert(String name);
}
mvn compile complains :
[ERROR] JdbiDaoImpl.java:[71,5] method does not override or implement a method from a supertype
[ERROR] JdbiDaoImpl.java:[73,78] cannot find symbol
[ERROR] symbol: method getHandle()
[ERROR] location: variable e of type com.example.JdbiDao
The problem locates in generated JdbiDaoImpl.java file, looking like:
public static class OnDemand implements JdbiDao {
private final Jdbi db;
public OnDemand(Jdbi db) {
this.db = db;
}
@Override
public long insert(String name) {
return (long) db.withExtension(JdbiDao.class, e -> e.insert(name));
}
@Override
public Handle getHandle() {
return (org.jdbi.v3.core.Handle) db.withExtension(JdbiDao.class, e -> e.getHandle());
}
@Override
public <R, X extends Exception> R withHandle(HandleCallback<R, X> callback) throws X {
return (R) db.withExtension(JdbiDao.class, e -> e.withHandle(callback));
}
}
The generated OnDemand class is not a subclass/implementation of SqlObject, so it failes when compiling the method getHandle & withHandle.
So is this the expected behavior as designed ?
Maybe a generator direction could be added to supress the generation of OnDemand class (add a member in annotation GenerateSqlObject ?).
The text was updated successfully, but these errors were encountered:
Given following code, jdbi-generator generates correct impl class of JdbiDao interface:
However for:
mvn compile
complains :The problem locates in generated
JdbiDaoImpl.java
file, looking like:The generated
OnDemand
class is not a subclass/implementation ofSqlObject
, so it failes when compiling the methodgetHandle
&withHandle
.So is this the expected behavior as designed ?
Maybe a generator direction could be added to supress the generation of
OnDemand
class (add a member in annotation GenerateSqlObject ?).The text was updated successfully, but these errors were encountered: