File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java 8 in Action this week in the Java 8 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: 40
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"/>
I agree. Here's the link:
subject: configuring jndi lookup
Similar Threads
facing not a know entity type problem in spring...plzz help me...
XML name space error in Spring data JPA hibernate applicationContext.xml
Spring Hibernate (JPA) integration
No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but