-
1. Re: A question about Configure Persistence Context with Orac
thomas2008ch May 10, 2008 2:11 PM (in response to thomas2008ch)Here is an example for using HSQL. But how can I set the username and password?
<persistence> <persistence-unit name="ejb3trail"> <jta-data-source>java:/DefaultDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
-
2. Re: A question about Configure Persistence Context with Orac
peterj May 10, 2008 3:41 PM (in response to thomas2008ch)Note that the persistence.xml file references a jta-data-source. You define this in a *-ds.xml file. You can find example *-ds.xml files for a variety of database in docs/examples/jca directory. The database information, such a username and password, go into the *-ds.xml file.
-
3. Re: A question about Configure Persistence Context with Orac
thomas2008ch May 10, 2008 3:53 PM (in response to thomas2008ch)OK, I find the file "oracle-ds.xml". It should be the correct one.
Besides I find some examples from the internet. The "persistence.xml" for Oracle looks as follow:<persistence> <persistence-unit name="ejb3trail"> <jta-data-source>java:/OracleDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
But:
1.
WHere can I put this file in my project? Under /META-INF/ ? Where the "persistence.xml" locates?
2.
How can the program or the server knows where the file "oracle-ds.xml" locates? Should I change the <jta-data-source/> in "persistence.xml" as follow?<persistence> <persistence-unit name="ejb3trail"> <jta-data-source>java:/oracle-ds</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
-
4. Re: A question about Configure Persistence Context with Orac
peterj May 10, 2008 11:06 PM (in response to thomas2008ch)Place the oracle-ds.xml file into the deploy directory and it will be deployed. Leave the jta-data-source as java:/OracleDS. The jta-data-source entry refers to the JNDI name for the data source, which comes from the jndi-name entry within the oracle-ds.xml file.
The persistence.xml file goes in the META-INF directory. -
5. Re: A question about Configure Persistence Context with Orac
thomas2008ch May 11, 2008 3:54 PM (in response to thomas2008ch)Many thanks.