Postgres & JAWS Wowes
johnmoore Nov 9, 2001 12:53 PM
Am having troubles with Postgres using the correct table name. We have a set of CMP entity beans against oracle that all work great. Thought I would try one against postgres to see how it goes.
JBoss 2.4.3 w/ Embedded Tomcat 3.2.3
RH Linux 7.1
Sun 1.3.1 JVM
jdbc7.0-1.2.jar
I took our working configuration and modified it for a simple new bean. I have standalone jdbc program that connects to the server just fine. My table name is "tester" and my bean ejb-name is PG. According to JAWS, it wants to select from "PG" instead of the "tester" table. I have a jaws.xml in my deployed jar with a table-name included. I'm stumped.
The container starts up cleanly, binds the datasource and the client can connect and get the home interface, when I call the findAll() method if bombs since the PG table doesn't exist.
[JAWS] findAll command executing: SELECT id FROM PG
[JAWS] java.sql.SQLException: ERROR: Relation 'pg' does not exist
[JAWS]
[JAWS] at org.postgresql.Connection.ExecSQL(Connection.java:393)
I have posted the configuation(s) in case anyone sees something that is just plain wrong.
ejb-jar.xml
-----------
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
Sample Postgres Application
<display-name>Postgres</display-name>
<enterprise-beans>
<ejb-name>PG</ejb-name>
test.PGHome
test.PG
<ejb-class>test.PGBean</ejb-class>
False
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>lname</field-name>
</cmp-field>
<cmp-field>
<field-name>fname</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<prim-key-class>java.lang.Integer</prim-key-class>
<persistence-type>Container</persistence-type>
<resource-ref>
<res-ref-name>jdbc/PostgresDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<ejb-name>PG</ejb-name>
<method-name>*</method-name>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
jboss.xml
---------
<?xml version="1.0" encoding="UTF-8"?>
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>jdbc/PostgresDataSource</res-name>
<res-jndi-name>java:/PostgresDataSource</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<ejb-name>PG</ejb-name>
<jndi-name>test/PG</jndi-name>
<configuration-name>Standard CMP EntityBean</configuration-name>
</enterprise-beans>
jaws.xml
--------
<?xml version="1.0" encoding="UTF-8"?>
PostgresDataSource
<type-mapping>PostgreSQL</type-mapping>
true
<default-entity>
<create-table>false</create-table>
<remove-table>false</remove-table>
<tuned-updates>true</tuned-updates>
<read-only>false</read-only>
<time-out>300</time-out>
<select-for-update>false</select-for-update>
</default-entity>
<type-mappings>
....
</type-mappings>
<ejb-name>PG</ejb-name>
<table-name>tester</table-name>
<create-table>false</create-table>
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
</cmp-field>
<cmp-field>
<field-name>lname</field-name>
<column-name>lname</column-name>
</cmp-field>
<cmp-field>
<field-name>fname</field-name>
<column-name>fname</column-name>
</cmp-field>
jboss.jcml
----------
PostgresDataSource
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
jdbc:postgresql://linuxdev1:5432/mydatabase
johnm
johnm
: