我怀疑在异常堆栈跟踪的末尾有您丢失的原因消息。例如,如果我在上面重复了您的示例,则会得到:
java.sql.SQLException: Could not call the constructor in class class com.j256.ormlite.table.CustomDaoTest$A_DaoImpl at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:22) ...Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ...Caused by: java.lang.IllegalArgumentException: Foreign field class>>>> com.j256.ormlite.table.CustomDaoTest$B does not have id field <<<<<< at com.j256.ormlite.field.FieldType.configDaoInformation(FieldType.java:332) ...
因为
A有一个class的外部字段
B,那么
B需要一个id字段。身份字段是外国字段所必需的。
我敢肯定
A,这
B是您的类的简化版本,因此,如果您发布更多包含所有原因信息的异常,我将适当地编辑答案。



