This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes configuring jndi lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "configuring jndi lookup" Watch "configuring jndi lookup" New topic

configuring jndi lookup

san krish
Ranch Hand

Joined: Aug 11, 2010
Posts: 41
I want to use JNDi lookup for DataBase. Where should i specify them. Rigtnow i have given the hibernate connections in persistance xml file with user name pwd etc. But i dont want to do this. I want to use JNDI lookup and configure my weblogic for the JNDI. What are the changes I need to make in the application context and persistance xml files. Pleas help?

my persistance .xml file looks like this,

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns=""

<persistence-unit name="jpaPersistance" transaction-type="RESOURCE_LOCAL">


<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.password" value="test"/>
<property name="hibernate.connection.url" value="jdbcracle:thin:@localhost:1521:xe"/>
<property name="hibernate.connection.username" value="test"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>



Application context looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<!-- <bean/> definitions here -->


<bean id="demoDataServiceImpl" class="" />

<bean id="recordGeneratorWebServiceHandler" class="">
<property name="service" ref="demoDataServiceImpl"/>

<bean id="entityManagerFactory"
<property name="persistenceUnitName" value="jpaPersistance"/>


<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager" >
<property name="entityManagerFactory" ref="entityManagerFactory"/>
subject: configuring jndi lookup
It's not a secret anymore!