0 Replies Latest reply on Nov 1, 2002 2:12 PM by Gayathri Vidyasankar

    Problem with container generated SQL

    Gayathri Vidyasankar Newbie

      I need help on the SQLs that are generated by Jboss during deployment of CMPs.

      I have 2 tables, AddressTest and PartyTest. Structures as below.

      Name Null? Type
      ------------------- -------- -------------
      ADDRESS_ID NOT NULL NUMBER (Primary key)
      ADDRESS_TYPE VARCHAR2(50)
      ADDRESS_FULL VARCHAR2(50)

      Name Null? Type
      ------------------ -------- ------------
      PARTY_ID NOT NULL NUMBER (Primary key)
      PARTY_NAME VARCHAR2(50)
      ADDRESS_ID NUMBER (FK references Address_test)

      I tried to create CMPs for the tables above,
      The beans gets deployed successfully in JBoss 3.0.3. But the INSERT statement of the Party_Test table generated by JBOSS has 2 Address_ids, Which causes problem while I try to test them.

      The insert statement is "INSERT INTO SCOTT.PARTY_TEST (PARTY_ID, PARTY_NAME, ADDRESS_ID, ADDRESS_ID) VALUES (?, ?, ?, ?)
      "

      Can any one help? I am not sure if there is some problem with the configuration or if this is the problem with JBoss container.



      09:48:20,500 DEBUG [AddressTest] Initializing CMP plugin for AddressTest
      09:48:20,515 DEBUG [AddressTest] Loading standardjbosscmp-jdbc.xml : file:/C:/jboss/jboss-3.0.3/server/default/conf
      /standardjbosscmp-jdbc.xml
      09:48:20,578 DEBUG [AddressTest] jar:file:/C:/jboss/jboss-3.0.3/server/default/tmp/deploy/server/default/deploy/par
      ty.ear/72.party.ear-contents/icjis-ejb.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults
      09:48:20,906 DEBUG [PartyTest] Initializing CMP plugin for PartyTest
      09:48:20,921 DEBUG [AddressTest] Entity Exists SQL: SELECT COUNT(*) FROM SCOTT.ADDRESS_TEST WHERE ADDRESS_ID=?
      09:48:20,921 DEBUG [AddressTest] Insert Entity SQL: INSERT INTO SCOTT.ADDRESS_TEST (ADDRESS_ID, ADDRESS_TYPE, ADDRE
      SS_FULL) VALUES (?, ?, ?)
      09:48:20,921 DEBUG [AddressTest] Remove SQL: DELETE FROM SCOTT.ADDRESS_TEST WHERE ADDRESS_ID=?
      09:48:20,921 DEBUG [AddressTest] Table not create as requested: SCOTT.ADDRESS_TEST
      09:48:20,921 DEBUG [findByPrimaryKey] SQL: SELECT ADDRESS_ID FROM SCOTT.ADDRESS_TEST WHERE ADDRESS_ID=?
      09:48:20,921 DEBUG [AddressTest] Added findByPrimaryKey query command for local home interface
      09:48:20,921 DEBUG [findByAddressFull] EJB-QL: SELECT DISTINCT OBJECT(o) FROM AddressTest o WHERE o.addressFull = ?
      1
      09:48:21,296 DEBUG [findByAddressFull] SQL: SELECT DISTINCT t0_o.ADDRESS_ID FROM SCOTT.ADDRESS_TEST t0_o WHERE t0_o
      .ADDRESS_FULL = ?
      09:48:21,312 DEBUG [findByAddressType] EJB-QL: SELECT DISTINCT OBJECT(o) FROM AddressTest o WHERE o.addressType = ?
      1
      09:48:21,312 DEBUG [findByAddressType] SQL: SELECT DISTINCT t0_o.ADDRESS_ID FROM SCOTT.ADDRESS_TEST t0_o WHERE t0_o
      .ADDRESS_TYPE = ?
      09:48:21,312 DEBUG [findAll] EJB-QL: SELECT OBJECT(o) FROM AddressTest o
      09:48:21,312 DEBUG [findAll] SQL: SELECT t0_o.ADDRESS_ID FROM SCOTT.ADDRESS_TEST t0_o
      09:48:21,328 DEBUG [PartyTest] Entity Exists SQL: SELECT COUNT(*) FROM SCOTT.PARTY_TEST WHERE PARTY_ID=?
      09:48:21,328 DEBUG [PartyTest] Insert Entity SQL: INSERT INTO SCOTT.PARTY_TEST (PARTY_ID, PARTY_NAME, ADDRESS_ID, A
      DDRESS_ID) VALUES (?, ?, ?, ?)
      09:48:21,328 DEBUG [PartyTest] Remove SQL: DELETE FROM SCOTT.PARTY_TEST WHERE PARTY_ID=?
      09:48:21,328 DEBUG [PartyTest] Table not create as requested: SCOTT.PARTY_TEST
      09:48:21,328 DEBUG [PartyTest] Foreign key constraint not added as requested: relationshipRolename=PARTY_TEST-cmp20
      -has-ADDRESS_TEST-cmp20
      09:48:21,328 DEBUG [PartyTest] Foreign key constraint not added as requested: relationshipRolename=ADDRESS_TEST-cmp
      20-has-PARTY_TEST-cmp20
      09:48:21,328 DEBUG [findByPrimaryKey] SQL: SELECT PARTY_ID FROM SCOTT.PARTY_TEST WHERE PARTY_ID=?
      09:48:21,328 DEBUG [PartyTest] Added findByPrimaryKey query command for local home interface
      09:48:21,328 DEBUG [findByPartyName] EJB-QL: SELECT DISTINCT OBJECT(o) FROM PartyTest o WHERE o.partyName = ?1
      09:48:21,328 DEBUG [findByPartyName] SQL: SELECT DISTINCT t0_o.PARTY_ID FROM SCOTT.PARTY_TEST t0_o WHERE t0_o.PARTY
      _NAME = ?
      09:48:21,328 DEBUG [findAll] EJB-QL: SELECT OBJECT(o) FROM PartyTest o
      09:48:21,343 DEBUG [findAll] SQL: SELECT t0_o.PARTY_ID FROM SCOTT.PARTY_TEST t0_o
      09:48:21,343 INFO [EjbModule] Started
      09:48:21,359 WARN [NestedThrowable] Duplicate throwable nesting of same base type: class org.jboss.deployment.Depl
      oymentException is assignable from: class org.jboss.deployment.DeploymentException
      09:48:21,406 INFO [jbossweb] Registered jboss.web:Jetty=0,JBossWebApplicationContext=4,context=/party
      09:48:21,453 INFO [jbossweb] Extract jar:file:/C:/jboss/jboss-3.0.3/server/default/tmp/deploy/server/default/deplo
      y/party.ear/72.party.ear-contents/party.war!/ to C:\DOCUME~1\vidyasg\LOCALS~1\Temp\Jetty_0_0_0_0_8080__party\webapp

      09:48:21,828 INFO [jbossweb] Started WebApplicationContext[/party,Web Client]
      09:48:21,859 INFO [jbossweb] successfully deployed file:/C:/jboss/jboss-3.0.3/server/default/tmp/deploy/server/def
      ault/deploy/party.ear/72.party.ear-contents/party.war to /party
      09:48:21,859 INFO [MainDeployer] Deployed package: file:/C:/jboss/jboss-3.0.3/server/default/deploy/party.ear
      09:48:21,859 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss/jboss-3.0.3/server/default/deploy/
      StockQuote.ear
      09:48:21,875 INFO [EARDeployer] Init J2EE application: file:/C:/jboss/jboss-3.0.3/server/default/deploy/StockQuote
      .ear
      09:48:21,968 INFO [jbossweb] Registered jboss.web:Jetty=0,JBossWebApplicationContext=5,context=/StockQuoteProj
      09:48:22,015 INFO [jbossweb] Extract jar:file:/C:/jboss/jboss-3.0.3/server/default/tmp/deploy/server/default/deplo
      y/StockQuote.ear/73.StockQuote.ear-contents/StockQuoteProj.war!/ to C:\DOCUME~1\vidyasg\LOCALS~1\Temp\Jetty_0_0_0_0
      _8080__StockQuoteProj\webapp
      09:48:22,625 INFO [jbossweb] Started WebApplicationContext[/StockQuoteProj,StockQuoteProj]
      09:48:22,656 INFO [jbossweb] successfully deployed file:/C:/jboss/jboss-3.0.3/server/default/tmp/deploy/server/def
      ault/deploy/StockQuote.ear/73.StockQuote.ear-contents/StockQuoteProj.war to /StockQuoteProj
      09:48:22,671 INFO [MainDeployer] Deployed package: file:/C:/jboss/jboss-3.0.3/server/default/deploy/StockQuote.ear

      09:48:22,687 INFO [URLDeploymentScanner] Started
      09:48:22,687 INFO [MainDeployer] Deployed package: file:/C:/jboss/jboss-3.0.3/server/default/conf/jboss-service.xm
      l
      09:48:22,687 INFO [Server] JBoss (MX MicroKernel) [3.0.3 Date:200209301503] Started in 0m:23s:281ms