0 Replies Latest reply on Feb 7, 2007 1:52 PM by Greg Zoller

    Prod/Dev Datasource Problem

    Greg Zoller Newbie


      I used seam-gen to create a project for Eclipse. No problem getting it to generate entities for my existing tables--even the generated web app pulled back data.

      I wanted to try the prod/dev datasource distinction, so for my project (Spurs) I have Spurs-prod-ds.xml and Spurs-dev-ds.xml. The only differences are the jndi name, database url and login credentials:




      Both spurs and spursdev have identical schemas and both of these database logins work fine going into MySQL manually. Inside my Spurs.ear I have a Spurs.jar with META-INF/persistence.xml:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      <persistence-unit name="Spurs">
       <property name="hibernate.hbm2ddl.auto" value="validate"/>
       <property name="hibernate.cache.use_query_cache" value="true"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/SpursEntityManagerFactory"/>

      Here's what happens: Seam appears to correctly find Spurs-dev-ds.xml from the jndi name when pesistence.xml is configured as above, but won't find my database tables and crashes my app. If I manually edit Spurs-dev-ds.xml and only change the tablename in the url (spursdev to spurs) and the name/pwd (gregdev to greg) to their prod counterparts everything works fine.

      Here's a clue: When aimed at prod (spurs) one line in the JBoss startup log looks like this:

      11:45:37,976 INFO [TableMetadata] table found: spurs.bucket

      The same line when pointed at spursdev looks like this:
      11:45:37,976 INFO [TableMetadata] table not found: bucket

      Notice that the prefix "spurs." is missing. Why didn't it look for "spursdev.bucket"?