引用来自“小鲅鱼”的评论
@RequiresPermissions("category:i18n")@Before({CategoryI18nEditValidator.class,Tx.class})publicvoidi18n(){...ACategoryModelacm=newACategoryModel();acm.set(ACategoryModel.NAME,name);acm.set(ACategoryModel.PARENT_ID,parentId);acm.set(ACategoryModel.DESCRIPTION,StringEscapeUtils.escapeHtml4(description));acm.set(ACategoryModel.TYPE,ACategoryModel.TYPE_I18N);acm.save();ACategoryLanguageModelcategoryLanguage=newACategoryLanguageModel();categoryLanguage.set(ACategoryLanguageModel.CATEGORY_ID,acm.getInt(ACategoryModel.ID));categoryLanguage.set(ACategoryLanguageModel.PARENT_ID,id);categoryLanguage.set(ACategoryLanguageModel.LANGUAGE_ID,languageId);categoryLanguage.save();...}
回复
@JFinal:是的正常了~~thx回复
@小鲅鱼:现在完全正常了吧?回复
@JFinal:刚才看了一下数据库,发现是id出问题,不知谁把id改成int了,郁闷回复
@小鲅鱼:id使用程序来生成可以搞定回复
@JFinal:去掉事务是可以的addMapping("table_name","primary_key_name",YourTable.class)
贴代码出来主要是事务提交问题在Ctrl下面使用Tx.class可不可手动提交事物
@RequiresPermissions("category:i18n")@Before({CategoryI18nEditValidator.class,Tx.class})publicvoidi18n(){...ACategoryModelacm=newACategoryModel();acm.set(ACategoryModel.NAME,name);acm.set(ACategoryModel.PARENT_ID,parentId);acm.set(ACategoryModel.DESCRIPTION,StringEscapeUtils.escapeHtml4(description));acm.set(ACategoryModel.TYPE,ACategoryModel.TYPE_I18N);acm.save();ACategoryLanguageModelcategoryLanguage=newACategoryLanguageModel();categoryLanguage.set(ACategoryLanguageModel.CATEGORY_ID,acm.getInt(ACategoryModel.ID));categoryLanguage.set(ACategoryLanguageModel.PARENT_ID,id);categoryLanguage.set(ACategoryLanguageModel.LANGUAGE_ID,languageId);categoryLanguage.save();...}
引用来自“小鲅鱼”的评论
@RequiresPermissions("category:i18n")@Before({CategoryI18nEditValidator.class,Tx.class})publicvoidi18n(){...ACategoryModelacm=newACategoryModel();acm.set(ACategoryModel.NAME,name);acm.set(ACategoryModel.PARENT_ID,parentId);acm.set(ACategoryModel.DESCRIPTION,StringEscapeUtils.escapeHtml4(description));acm.set(ACategoryModel.TYPE,ACategoryModel.TYPE_I18N);acm.save();ACategoryLanguageModelcategoryLanguage=newACategoryLanguageModel();categoryLanguage.set(ACategoryLanguageModel.CATEGORY_ID,acm.getInt(ACategoryModel.ID));categoryLanguage.set(ACategoryLanguageModel.PARENT_ID,id);categoryLanguage.set(ACategoryLanguageModel.LANGUAGE_ID,languageId);categoryLanguage.save();...}