5 Replies Latest reply on Aug 8, 2003 3:51 AM by artmotion

    Peoples experience with 3.2.1 Doc

    nathanpp

      Anything good?

        • 1. Re: Peoples experience with 3.2.1 Doc
          artmotion

          Very good.

          I bought it last weekend. Many advanced topics - really nice for a beginner like myself :)

          I learned so much on the cmp chapter itself - it's really amazing.

          One minor down side: I still don't have the examples running with my PostgreSQL DB :( But I'm working on it!

          • 2. Re: Peoples experience with 3.2.1 Doc
            darryl_staflund

            Hi there,

            What sort of problems are you encountering with PostgreSQL on 3.2.1? We're using it with no problems. Maybe I can give you a hand?

            Darryl

            • 3. Re: Peoples experience with 3.2.1 Doc
              artmotion

              Would be nice. (Maybe we could also use personal email to get this done)

              Okay, here are my steps:
              Windows 2000
              Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
              jboss-3.2.1-tomcat-4.1.24 (my JBOSS_HOME points to it)
              PostgreSQL 7.3.4 Linux
              JDBC Driver from postgresq homepage -> pg73jdbc3.jar (181 kB)

              Using the cmp2 example from the paid docs (AdminBook 3.2.1):

              First I create the postgre-ds.xml and set JNDI name to PostgreDS.

              Then I edit the src\main\org\jboss\cmp2\jbosscmp-jdbc.xml to connect to PostgreSQL:

              java:/PostgreDS
              <datasource-mapping>PostgreSQL 7.2</datasource-mapping>
              <create-table>true</create-table>
              <remove-table>true</remove-table>
              <pk-constraint>true</pk-constraint>
              <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


              then I uncomment:
              <!-- <entity-command name="hsqldb-fetch-key"/> -->
              and use
              <entity-command name="get-last-oid" class="org.jboss.ejb.plugins.cmp.jdbc.postgres.JDBCPostgresCreateCommand"/>
              or
              <entity-command name="pk-sql" class="org.jboss.ejb.plugins.cmp.jdbc.JDBCPkSqlCreateCommand">
              select nextval('public.global_seq')
              </entity-command>
              (to select from a sequence with existis)
              or
              <entity-command name="pk-sql" class="org.jboss.ejb.plugins.cmp.jdbc.JDBCPkSqlCreateCommand">
              select ceil(random()*1000)
              </entity-command>
              BTW: nothing seems to work :-(

              In the conf directory of Jboss I edited standardjbosscmp-jdbc.xml:
              Below PostgreSQL 7.2
              I changed the foreign-key template to:
              <fk-constraint-template>ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4 (?5) DEFERRABLE INITIALLY DEFERRED</fk-constraint-template>

              and I added (found in JBoss-3.2.2RC2)
              <auto-increment-template>?1</auto-increment-template>


              This is what I get:
              Running without the auto-increment-template:
              ant -Dchap=cmp2 clean
              ant -Dchap=cmp2 config
              I get:
              10:22:22,645 INFO [OrganizationEJB] Created table 'organization' successfully.
              10:22:23,095 INFO [GangsterEJB] Created table 'gangster' successfully.
              10:22:23,286 INFO [GangsterEJB] Created table 'gangster_enemies' successfully.
              10:22:24,587 INFO [JobEJB] Created table 'job' successfully.
              10:22:24,798 INFO [JobEJB] Created table 'gangster_job' successfully.
              10:22:24,818 ERROR [EntityContainer] Starting failed
              java.lang.IllegalStateException: auto-increment template not found

              and many more....
              Then I add the auto-increment template
              <auto-increment-template>?1</auto-increment-template> in standardjbosscmp-jdbc.xml (in the default config of jboss)
              and I get:

              10:30:41,121 INFO [EjbModule] Started
              10:30:41,121 INFO [EJBDeployer] Deployed: file:/D:/java/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/cmp2-ex1.jar
              10:30:41,392 INFO [MainDeployer] Deployed package: file:/D:/java/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/cmp2-ex1.jar
              10:30:43,755 INFO [OrganizationBean$Proxy] Creating organization Yakuza, Japanese Gangsters
              10:30:43,945 INFO [OrganizationBean$Proxy] Creating organization Mafia, Italian Bad Guys
              10:30:43,955 INFO [OrganizationBean$Proxy] Creating organization Triads, Kung Fu Movie Extras
              10:30:43,965 INFO [GangsterBean$Proxy] Creating Gangster 0 'Bodyguard' Yojimbo
              10:30:44,086 ERROR [LocationEJB] Could not create entity
              java.sql.SQLException: ERROR: ExecInsert: Fail to add null value in not null attribute id
              at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)

              Maybe you could tell me what I'm doing so wrong.
              Are you could pack a working JBoss3.2.1 + PostgreSQL JDBC driver + cmp2 completly working + notes what was wrong and send it :)

              If now spent 4+ days on getting the cmp2 with postgreSQL working


              • 4. Re: Peoples experience with 3.2.1 Doc
                artmotion

                 

                "artmotion" wrote:
                Here the 3 files


                • 5. Example cmp2 is not example cmp2
                  artmotion

                  Update an myself!

                  The cmp2 example for the Template Tutorial 3.0 is much simpler than the paid one!

                  The "simple" cmp2 is working on PostgreSQL (okay, it doesn't autogen PKs) but the "complex"/paid cmp2 example won't work *grrr*