当前位置: 代码迷 >> Java Web开发 >> hibernate <many to many> 与 sql2000 的有关问题
  详细解决方案

hibernate <many to many> 与 sql2000 的有关问题

热度:905   发布时间:2016-04-17 15:33:22.0
hibernate <many to many> 与 sql2000 的问题
想做一个many   to   many   的程序.但是插入数据时总是出错.
type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.hibernate.exception.SQLGrammarException:   could   not   insert   collection:   [org.mybeans.Student.teachers#3]
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:935)
org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:23)
org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
org.mydaos.StuDAO.save(StuDAO.java:13)
org.myservlets.AddTest.doGet(AddTest.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.6   logs.

不知是什么意思..大家有遇到过这样的情况吗?   请教各位该如何解决!

------解决方案--------------------
有个Field肯定不能是Collection了。
比如说老师和课程是多对多关系,但是实际上具体课程和老师是一对一啊。

代码迷推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.daimami.com/search?q=317
  相关解决方案