hibernate多對多例子-方便以后查看(三)
1.建表

















StudentVO





























寫配置文件
Student.hbm.xml






























Course.hbm.xml


























接著把下面的hibernate.properties文件拷到classes目錄下。。這里用的是mysql













































































































































































?
好。。可以了。。
posted on 2006-04-08 11:11 record java and net 閱讀(25615) 評論(18) 編輯 收藏 所屬分類: java
blogjava's web log
...
1.建表
?
好。。可以了。。
posted on 2006-04-08 11:11 record java and net 閱讀(25615) 評論(18) 編輯 收藏 所屬分類: java
我會常來的。。
希望經(jīng)常更新。。 回復 更多評論
如果不用java Applet 用jsp結(jié)合java怎么實現(xiàn)曲線圖?
謝謝 回復 更多評論
我按照你的寫的去做了,為什么我的錯誤是這樣的呢》
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert collection: [many_to_many.Course.student#31]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1058)
at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:26)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at many_to_many.Test_Many_To_Many.main(Test_Many_To_Many.java:73)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對象名 'Stu_cou' 無效。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1039)
... 10 more
回復 更多評論
我的關(guān)聯(lián)表是Stu_cou,我一直不知道為什么?請指教!謝謝! 回復 更多評論
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對象名 'Stu_cou' 無效。
你自己好好找找吧。。
回復 更多評論
@yuxb
你很可能把默認的數(shù)據(jù)庫設錯了,
“對象名無效”一般是這個原因 回復 更多評論
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對象名 'Stu_cou' 無效。
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫名字
就行了 回復 更多評論
@王模
謝謝 你
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫名字
我解決了上樓的兩個異常問題 回復 更多評論
@王模
真的挺感謝你的 我加上了
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫名字
解決了
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對象名 'Stu_cou' 無效。
異常
回復 更多評論
js+dom+jsp+servlet(struts)+ajax+hibernate;用這些技術(shù)搞? 能搞定嗎?
用這些技術(shù)跟hibernate結(jié)合一起用你能寫個例子嗎? 回復 更多評論
只有注冊用戶登錄后才能發(fā)表評論。 | ||
![]() |
||
網(wǎng)站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
|
||
相關(guān)文章:
|
||