JBoss中cmr時複合關鍵字類的foreign keys mapping問題
individualDetailBean-->companyBranchBean,CompanyBranchBean的masterID、branchID皆為主鍵,故定義CompanyBranchPK,略去<primary-field>
1.複合關鍵字類的問題:
(1). ejb-jar.xml
<entity>
<display-name>CompanyBranchBean</display-name>
<ejb-name>CompanyBranchBean</ejb-name>
<local-home>org.vp.eservice.user.ejb.CompanyBranchLocalHome</local-home>
<local>org.vp.eservice.user.ejb.CompanyBranchLocal</local>
<ejb-class>org.vp.eservice.user.ejb.CompanyBranchBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>org.vp.eservice.user.ejb.CompanyBranchPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CompanyBranch</abstract-schema-name>
<cmp-field>
<field-name>masterID</field-name>
</cmp-field>
<cmp-field>
<field-name>branchID</field-name>
</cmp-field>
<cmp-field>
<field-name>name1</field-name>
</cmp-field>
<cmp-field>
<field-name>name2</field-name>
</cmp-field>
</entity>
(2).jbosscmp-jdbc.xml
<ejb-relation>
<ejb-relation-name>individualDetail-companyBranch</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>IndividualDetailRelationshipRole</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>CompanyBranchRelationshipRole</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>branchID</field-name>
<column-name>BranchID</column-name>
</key-field>
<key-field>
<field-name>masterID</field-name>
<column-name>MasterID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
部署時JBoss報錯:Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey-field> is missing from ejb-jar.xml): ejb-relation-name=individualDetail-companyBranch,將field改位置也不行,定是jbosscmp-jdbc.xml未寫對。
2.另外,此job中還有自增量的問題:addressBean的主鍵addressID為自增量,故jbosscmp-jdbc.xml設為unknow pk,而在foreign keys mapping時,其它Bean找不到addressID,jbosscmp-jdbc.xml不知怎樣寫,或是JBoss不支援?
1.複合關鍵字類的問題:
(1). ejb-jar.xml
<entity>
<display-name>CompanyBranchBean</display-name>
<ejb-name>CompanyBranchBean</ejb-name>
<local-home>org.vp.eservice.user.ejb.CompanyBranchLocalHome</local-home>
<local>org.vp.eservice.user.ejb.CompanyBranchLocal</local>
<ejb-class>org.vp.eservice.user.ejb.CompanyBranchBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>org.vp.eservice.user.ejb.CompanyBranchPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CompanyBranch</abstract-schema-name>
<cmp-field>
<field-name>masterID</field-name>
</cmp-field>
<cmp-field>
<field-name>branchID</field-name>
</cmp-field>
<cmp-field>
<field-name>name1</field-name>
</cmp-field>
<cmp-field>
<field-name>name2</field-name>
</cmp-field>
</entity>
(2).jbosscmp-jdbc.xml
<ejb-relation>
<ejb-relation-name>individualDetail-companyBranch</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>IndividualDetailRelationshipRole</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>CompanyBranchRelationshipRole</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>branchID</field-name>
<column-name>BranchID</column-name>
</key-field>
<key-field>
<field-name>masterID</field-name>
<column-name>MasterID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
部署時JBoss報錯:Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey-field> is missing from ejb-jar.xml): ejb-relation-name=individualDetail-companyBranch,將field改位置也不行,定是jbosscmp-jdbc.xml未寫對。
2.另外,此job中還有自增量的問題:addressBean的主鍵addressID為自增量,故jbosscmp-jdbc.xml設為unknow pk,而在foreign keys mapping時,其它Bean找不到addressID,jbosscmp-jdbc.xml不知怎樣寫,或是JBoss不支援?
相關文章
- 緊急求助benq:JBoss中cmr時複合關鍵字類的foreign keys mapping如何配置ENQAPP
- 懇請benq指點:JBoss中cmr時複合關鍵字類的foreign keys mapping問題,線上等待!ENQAPP
- 看懂js中this關鍵字的指向問題JS
- JBOSS 做專案時的問題 有關Jboss, Mbean, Session bean 求助BeanSession
- jboss直接執行類的問題?
- hibernate複合主鍵查詢問題
- 各類關鍵字
- abstract關鍵字 super 關鍵字 類與繼承繼承
- static關鍵字---"工具類"
- JavaScript 複習之 this關鍵字JavaScript
- JAVA中的關鍵字Java
- javascript中的with關鍵字JavaScript
- 解決Linq.ToDictionary()時的鍵重複問題
- java中this關鍵字Java
- JavaScript中this關鍵字JavaScript
- 關於primary key和foreign key的問題處理
- mysql 中的explain關鍵字MySqlAI
- java中this關鍵字的用法Java
- java中的static關鍵字Java
- 有關jboss開發EJB的JAR的問題?JAR
- JAVA面試題 淺析Java中的static關鍵字Java面試題
- synchronized關鍵字問題?各位高手,幫幫忙!synchronized
- jbuilderx+jboss3 釋出war時的問題UIS3
- 關於安裝jboss+tomcat的問題Tomcat
- 注意:Oracle中的聯合主鍵查詢問題(轉)Oracle
- 完全理解JavaScript中的this關鍵字JavaScript
- java中的instanceof關鍵字Java
- Java中的各種關鍵字Java
- 在Java中this關鍵字的使用Java
- Java中transient關鍵字的作用Java
- java中static關鍵字的作用Java
- Java中的static關鍵字解析Java
- 說說iOS中的常用的關鍵字static ,class(僅限Swift關鍵字)iOSSwift
- AutoItlibrary 在 RF 和 PyCharm 使用中關鍵字不一致的問題PyCharm
- JBoss和WebService的問題Web
- typescript 中的 infer 關鍵字的理解TypeScript
- 專案管理中的關鍵問題有哪些「上篇」專案管理
- 專案管理中的關鍵問題有哪些「下篇」專案管理