天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 3556|回复: 6

新建用户出错

[复制链接]
lejuo 发表于 2011-5-16 14:05:54 | 显示全部楼层 |阅读模式
本帖最后由 shary 于 2011-5-23 09:31 编辑

新建用户不成功,后台报告这样的异常,请帮忙解决
  1. Hibernate: insert into T_USER (CALENDAR, LEVELS, REMARKS, SUPERIOR, PROXYUSER, DEFAULTDEPARTMENT, DEFAULTAPPLICATION, EMAIL, LOGINNO, LOGINPWD, NAME, TELEPHONE, STATUS, DOMAINID, FIELD1, FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7, FIELD8, FIELD9, FIELD10, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  2. Hibernate: insert into T_USER_DEPARTMENT_SET (DEPARTMENTID, USERID, ID) values (?, ?, ?)
  3. 14:00:20,953  WARN JDBCExceptionReporter:77 - SQL Error: 547, SQLState: 23000
  4. 14:00:20,953 ERROR JDBCExceptionReporter:78 - INSERT 语句与 FOREIGN KEY 约束"FKE184DC5EF336993C"冲突。该冲突发生于数据库"vos2_4",表"dbo.T_USER", column 'ID'。
  5. 14:00:20,968 ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
  6. org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  7.         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
  8.         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
  9.         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
  10.         at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)
  11.         at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
  12.         at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
  13.         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2220)
  14.         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)
  15.         at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
  16.         at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
  17.         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
  18.         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
  19.         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
  20.         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
  21.         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
  22.         at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
  23.         at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
  24.         at cn.myapps.base.dao.HibernateBaseDAO.commitTransaction(HibernateBaseDAO.java:760)
  25.         at cn.myapps.base.dao.PersistenceUtils.commitTransaction(PersistenceUtils.java:127)
  26.         at cn.myapps.core.user.ejb.UserProcessBean.doCreate(UserProcessBean.java:74)
  27.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207.CGLIB$doCreate$8(<generated>)
  28.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207$$FastClassByCGLIB$$81f78765.invoke(<generated>)
  29.         at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
  30.         at cn.myapps.util.ProcessFactory.intercept(ProcessFactory.java:138)
  31.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207.doCreate(<generated>)
  32.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  33.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  34.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  35.         at java.lang.reflect.Method.invoke(Method.java:589)
  36.         at com.jamonapi.proxy.MonProxy.invoke(MonProxy.java:110)
  37.         at $Proxy18.doCreate(Unknown Source)
  38.         at cn.myapps.core.user.action.UserAction.doSave(UserAction.java:252)
  39.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  40.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  41.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  42.         at java.lang.reflect.Method.invoke(Method.java:589)
  43.         at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:365)


  44.         at cn.myapps.base.web.filter.OBPMFilterDispatcher.doFilter(OBPMFilterDispatcher.java:43)
  45.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  46.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  47.         at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:78)
  48.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  49.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  50.         at cn.myapps.base.web.filter.AjaxMultiLanguageFilter.doFilter(AjaxMultiLanguageFilter.java:40)
  51.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  52.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  53.         at cn.myapps.base.web.filter.PersistenceFilter.doFilter(PersistenceFilter.java:30)
  54.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  55.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  56.         at cn.myapps.base.web.filter.SecurityFilter.doFilter(SecurityFilter.java:125)


  57.         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
  58.         at java.lang.Thread.run(Thread.java:619)
  59. Caused by: java.sql.BatchUpdateException: INSERT 语句与 FOREIGN KEY 约束"FKE184DC5EF336993C"冲突。该冲突发生于数据库"vos2_4",表"dbo.T_USER", column 'ID'。
  60.         at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:944)
  61.         at sun.reflect.GeneratedMethodAccessor879.invoke(Unknown Source)
  62.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  63.         at java.lang.reflect.Method.invoke(Method.java:589)
  64.         at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
  65.         at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
  66.         at $java.sql.PreparedStatement$$EnhancerByProxool$$ce065e28.executeBatch(<generated>)
  67.         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
  68.         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
  69.         ... 84 more
  70. java.lang.Exception: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  71.         at cn.myapps.base.dao.PersistenceUtils.commitTransaction(PersistenceUtils.java:129)
  72.         at cn.myapps.core.user.ejb.UserProcessBean.doCreate(UserProcessBean.java:74)
  73.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207.CGLIB$doCreate$8(<generated>)
  74.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207$$FastClassByCGLIB$$81f78765.invoke(<generated>)
  75.         at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
  76.         at cn.myapps.util.ProcessFactory.intercept(ProcessFactory.java:138)
  77.         at cn.myapps.core.user.ejb.UserProcessBean$$EnhancerByCGLIB$$c2dad207.doCreate(<generated>)
  78.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  79.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  80.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  81.         at java.lang.reflect.Method.invoke(Method.java:589)
  82.         at com.jamonapi.proxy.MonProxy.invoke(MonProxy.java:110)
  83.         at $Proxy18.doCreate(Unknown Source)
  84.         at cn.myapps.core.user.action.UserAction.doSave(UserAction.java:252)
  85.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  86.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  87.                 ......
  88.         at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:233)
  89.         at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:198)
  90.         at cn.myapps.base.web.filter.OBPMFilterDispatcher.doFilter(OBPMFilterDispatcher.java:43)
  91.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  92.         at cn.myapps.base.web.filter.PersistenceFilter.doFilter(PersistenceFilter.java:30)
  93.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  94.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  95.         at cn.myapps.base.web.filter.SecurityFilter.doFilter(SecurityFilter.java:125)
  96.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

  97. Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  98.         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
  99.         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
  100.         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2220)
  101.         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)
  102.         at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
  103.         at cn.myapps.base.dao.HibernateBaseDAO.commitTransaction(HibernateBaseDAO.java:760)
  104.         at cn.myapps.base.dao.PersistenceUtils.commitTransaction(PersistenceUtils.java:127)
  105.         ... 68 more
  106. Caused by: java.sql.BatchUpdateException: INSERT 语句与 FOREIGN KEY 约束"FKE184DC5EF336993C"冲突。该冲突发生于数据库"vos2_4",表"dbo.T_USER", column 'ID'。
  107.         at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:944)
  108.         at sun.reflect.GeneratedMethodAccessor879.invoke(Unknown Source)
  109.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  110.         at java.lang.reflect.Method.invoke(Method.java:589)
  111.         at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
  112.         at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
  113.         at $java.sql.PreparedStatement$$EnhancerByProxool$$ce065e28.executeBatch(<generated>)
  114.         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
  115.         ... 84 more
复制代码
 楼主| lejuo 发表于 2011-5-16 14:27:05 | 显示全部楼层
回复 2# cathy


    当保存并新建一个用户时,出现这样的异常。

   数据库用mssql ,平台用2.4版本的平台。

   另外,我的T_user表中目前只有11条记录。 t_user_department_set表中有多达33条记录,表t_user_department_set中userid为空的记录是否可以用sql语句删除而不会对系统造成影响???

   

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册成为天翎用户

x
 楼主| lejuo 发表于 2011-5-16 14:37:44 | 显示全部楼层
回复 4# cathy


    那保存并新建出现的异常,,,怎么解决呀?
 楼主| lejuo 发表于 2011-5-16 14:44:38 | 显示全部楼层
回复 6# cathy


    保存并新建后,添加用户到系统中,再次点击保存时,后台提示楼上的异常,前台提示“保存成功”,查找用户表刚才建立的用户不存在。。。
 楼主| lejuo 发表于 2011-5-16 15:36:48 | 显示全部楼层
回复 8# cathy


    我晕。。

   这个问题是你们平台存在的问题呀,,
   截图的这个地方出错
   

   查找了一些资料。。

   http://zhidao.baidu.com/question/38915173.html
     http://hi.baidu.com/lalalove_yay ... bcb9c9a044dfe8.html

    应该是主外键存在关联,而hibernate在新增数据时,先插入了t_user_department_set表数据,再插入了t_user数据?

   或者代码中写的插入代码不符合hibernate规范?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册成为天翎用户

x
 楼主| lejuo 发表于 2011-5-16 16:01:33 | 显示全部楼层
回复 10# cathy


    我晕。。。没有插入数据呀?
   一条sql语句都没有用呀。。


   直接在平台后台操作的呀。。。。

   找了好久还是没有解决问题的。。
 楼主| lejuo 发表于 2011-5-16 16:24:14 | 显示全部楼层
回复 12# cathy


   是的呀,,,gg

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 10:33

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表