We had a JNDI file created by our server admin, and the key was to match the name of the JNDI (not the filename) in all the places it's referenced in Eclipse. This would enable our web apps to reference that one JNDI for the specific connection, instead of having multiple JNDI for each app. Eclipse doesn't allow the user (as far as I know) to choose the JNDI name itself; it gives a name to it based on the project. For example, in the persistence.xml file, it inserts this:
Code:
<jta-data-source>java:/project_nameDatasource</jta-data-source>
I used a tool called Agent Ransack to search my project folder and replace all the references to this name with the JNDI name on the server. I also had to clear the project and JBoss cache and ensure that the hibernate-console.properties file had the same connection info as the JNDI file on the server. This finally enabled the Eclipse "Seam Generate Entities" wizard to see the database and be able to reverse engineer its tables. It took almost a week of trial-and-error to figure out the purpose of the different files and get their settings right. Not an experience I'd ever, ever want to repeat. And during that time, I researched on Google for information countless times and came up with just little bits of info on what I was trying to do.