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

















StudentVO





























寫配置文件
Student.hbm.xml






























Course.hbm.xml


























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













































































































































































?
好。。可以了。。
posted on 2006-04-08 11:11 record java and net 閱讀(25613) 評(píng)論(18) 編輯 收藏 所屬分類: java
blogjava's web log
...
1.建表
?
好。。可以了。。
posted on 2006-04-08 11:11 record java and net 閱讀(25613) 評(píng)論(18) 編輯 收藏 所屬分類: java
不錯(cuò)啊。。
回復(fù) 更多評(píng)論
我會(huì)常來(lái)的。。
希望經(jīng)常更新。。 回復(fù) 更多評(píng)論
:)
回復(fù) 更多評(píng)論
如果不用java Applet 用jsp結(jié)合java怎么實(shí)現(xiàn)曲線圖?
謝謝 回復(fù) 更多評(píng)論
我按照你的寫的去做了,為什么我的錯(cuò)誤是這樣的呢》
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]對(duì)象名 'Stu_cou' 無(wú)效。
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
回復(fù) 更多評(píng)論
我的關(guān)聯(lián)表是Stu_cou,我一直不知道為什么?請(qǐng)指教!謝謝! 回復(fù) 更多評(píng)論
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對(duì)象名 'Stu_cou' 無(wú)效。
你自己好好找找吧。。
回復(fù) 更多評(píng)論
刪除的代碼呢?這才是關(guān)鍵 回復(fù) 更多評(píng)論
你的鍵寫的不對(duì)就會(huì)出這和情況 回復(fù) 更多評(píng)論
@yuxb
你很可能把默認(rèn)的數(shù)據(jù)庫(kù)設(shè)錯(cuò)了,
“對(duì)象名無(wú)效”一般是這個(gè)原因 回復(fù) 更多評(píng)論
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對(duì)象名 'Stu_cou' 無(wú)效。
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫(kù)名字
就行了 回復(fù) 更多評(píng)論
@王模
謝謝 你
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫(kù)名字
我解決了上樓的兩個(gè)異常問(wèn)題 回復(fù) 更多評(píng)論
@王模
真的挺感謝你的 我加上了
在set里加上 schema="dbo" catalog="OA" //OA是數(shù)據(jù)庫(kù)名字
解決了
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]對(duì)象名 'Stu_cou' 無(wú)效。
異常
回復(fù) 更多評(píng)論
真好,分享了~ 回復(fù) 更多評(píng)論
不錯(cuò)正在學(xué) 回復(fù) 更多評(píng)論
用sturts 怎么搞? 回復(fù) 更多評(píng)論
js+dom+jsp+servlet(struts)+ajax+hibernate;用這些技術(shù)搞? 能搞定嗎?
用這些技術(shù)跟hibernate結(jié)合一起用你能寫個(gè)例子嗎? 回復(fù) 更多評(píng)論
@yuxb
就是不用連接池 jdbc也要有的啊,否則怎么連到數(shù)據(jù)庫(kù) 回復(fù) 更多評(píng)論
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
管理
|
||
相關(guān)文章:
|
||