【发布时间】:2017-06-12 19:55:52
【问题描述】:
我还有另一个问题(似乎与:stored procedure 'auto_pk_for_table' not found 相同)但是我将 ID 和“数据库生成”的自动增量和唯一索引与我的自动增量字段放在主键中,见:
public abstract class _DateInfo extends CayenneDataObject {
public static final String ENDDATETIME_PROPERTY = "enddatetime";
public static final String STARTDATETIME_PROPERTY = "startdatetime";
public static final String USER_ID_PROPERTY = "userId";
public static final String DATEINFOID_PK_COLUMN = "DATEINFOID";
public static final String USERID_PK_COLUMN = "USERID";
public void setEnddatetime(Date enddatetime) {
writeProperty(ENDDATETIME_PROPERTY, enddatetime);
}
public Date getEnddatetime() {
return (Date)readProperty(ENDDATETIME_PROPERTY);
}
public void setStartdatetime(Date startdatetime) {
writeProperty(STARTDATETIME_PROPERTY, startdatetime);
}
public Date getStartdatetime() {
return (Date)readProperty(STARTDATETIME_PROPERTY);
}
public void setUserId(int userId) {
writeProperty(USER_ID_PROPERTY, userId);
}
public int getUserId() {
Object value = readProperty(USER_ID_PROPERTY);
return (value != null) ? (Integer) value : 0;
}
}
点击保存按钮时,我尝试保存当地时间:
Button save = new Button("Save", event -> {
DateInfoFactory date = CayenneUtil.getContext().newObject(
DateInfoFactory.class);
date.setUserId(userIdSelected);
if (startTime.getValue() != null) {
LocalTime startDate = startTime.getValue();
date.setStartdatetime(toDate(startDate));
}
date.getObjectContext().commitChanges();
});
save.addStyleName(ValoTheme.BUTTON_PRIMARY);
然后,我收到了这个错误:
juin 12, 2017 9:38:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger logQuery
INFOS: LOCK TABLES AUTO_PK_SUPPORT WRITE
juin 12, 2017 9:38:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger logQuery
INFOS: UNLOCK TABLES
juin 12, 2017 9:38:32 PM com.vaadin.server.DefaultErrorHandler doDefault
GRAVE:
org.apache.cayenne.CayenneRuntimeException: [v.4.0.M5 Feb 24 2017 07:47:55] Commit Exception
..
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mam.auto_pk_support' doesn't exist
我该怎么办?
谢谢,
【问题讨论】:
-
Table 'mam.auto_pk_support' doesn't exist- 检查您在哪里定义表名。看起来不正确。 -
一切都在 Cayenne 中设置,表名似乎很好。 mam 是我的架构,datainfo 是我的表名
标签: mysql jakarta-ee vaadin apache-cayenne